]> git.openstreetmap.org Git - rails.git/blobdiff - app/models/way.rb
better handling of duplicate tags. Extra validation in the tests.
[rails.git] / app / models / way.rb
index 2071fd559c33ddd136da6608a71606f4698362b7..d4bca19aacfb3af26b912be6979f2fe265eecaf4 100644 (file)
@@ -34,8 +34,8 @@ class Way < ActiveRecord::Base
       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
 
@@ -182,7 +182,7 @@ class Way < 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("way", self.id, k) if @tags.include? k
 
     @tags[k] = v
   end