doc.find('//osm/node').each do |pt|
return Node.from_xml_node(pt, create)
end
- rescue
- return nil
+ rescue LibXML::XML::Error => ex
+ raise OSM::APIBadXMLError.new("node", xml, ex.message)
end
end
# duplicate tags are now forbidden, so we can't allow values
# in the hash to be overwritten.
- raise OSM::APIDuplicateTagsError.new if @tags.include? k
+ raise OSM::APIDuplicateTagsError.new("node", self.id, k) if @tags.include? k
@tags[k] = v
end
# duplicate tags are now forbidden, so we can't allow values
# in the hash to be overwritten.
- raise OSM::APIDuplicateTagsError.new if @tags.include? k
+ raise OSM::APIDuplicateTagsError.new("relation", self.id, k) if @tags.include? k
@tags[k] = v
end
doc.find('//osm/way').each do |pt|
return Way.from_xml_node(pt, create)
end
- rescue
- return nil
+ rescue LibXML::XML::Error => ex
+ raise OSM::APIBadXMLError.new("relation", xml, ex.message)
end
end
# duplicate tags are now forbidden, so we can't allow values
# in the hash to be overwritten.
- raise OSM::APIDuplicateTagsError.new if @tags.include? k
+ raise OSM::APIDuplicateTagsError.new("way", self.id, k) if @tags.include? k
@tags[k] = v
end
content node_xml
put :update, :id => current_nodes(:visible_node).id
assert_response :bad_request,
- "adding duplicate tags to a node should fail with 'bad request'"
+ "adding duplicate tags to a node should fail with 'bad request'"
+ assert_equal "Element node/#{current_nodes(:visible_node).id} has duplicate tags with key #{current_node_tags(:t1).k}.", @response.body
end
# test whether string injection is possible
put :update, :id => current_ways(:visible_way).id
assert_response :bad_request,
"adding a duplicate tag to a way should fail with 'bad request'"
+ assert_equal "Element way/#{current_ways(:visible_way).id} has duplicate tags with key #{current_way_tags(:t1).k}.", @response.body
end
##
put :update, :id => current_ways(:visible_way).id
assert_response :bad_request,
"adding new duplicate tags to a way should fail with 'bad request'"
+ assert_equal "Element way/#{current_ways(:visible_way).id} has duplicate tags with key i_am_a_duplicate.", @response.body
end
##
put :create
assert_response :bad_request,
"adding new duplicate tags to a way should fail with 'bad request'"
+ assert_equal "Element way/ has duplicate tags with key addr:housenumber.", @response.body
end
##