]> git.openstreetmap.org Git - rails.git/blobdiff - app/models/node.rb
ensure that uploads that don't supply a lat and lon for a node. Adding related test...
[rails.git] / app / models / node.rb
index b2650b61da5db244c7b3c999c60593f4b5049f23..e90c329507c9af7c244fe8129038fda103aa0099 100644 (file)
@@ -79,11 +79,13 @@ class Node < ActiveRecord::Base
   def self.from_xml_node(pt, create=false)
     node = Node.new
     
+    raise OSM::APIBadXMLError.new("node", pt, "lat missing") if pt['lat'].nil?
+    raise OSM::APIBadXMLError.new("node", pt, "lon missing") if pt['lon'].nil?
     node.lat = pt['lat'].to_f
     node.lon = pt['lon'].to_f
     node.changeset_id = pt['changeset'].to_i
 
-    return nil unless node.in_world?
+    raise OSM::APIBadUserInput.new("The node is outside this world") unless node.in_world?
 
     # version must be present unless creating
     return nil unless create or not pt['version'].nil?