]> git.openstreetmap.org Git - rails.git/blobdiff - app/models/node.rb
better handling of duplicate tags. Extra validation in the tests.
[rails.git] / app / models / node.rb
index e1ad818ddec0c53991690a3c52727d7a09af930f..b2650b61da5db244c7b3c999c60593f4b5049f23 100644 (file)
@@ -71,8 +71,8 @@ class Node < ActiveRecord::Base
       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
 
@@ -274,7 +274,7 @@ class Node < ActiveRecord::Base
 
     # 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