]> git.openstreetmap.org Git - rails.git/blobdiff - app/controllers/node_controller.rb
various things
[rails.git] / app / controllers / node_controller.rb
index 428d4b9c2005541846a781346856a9b42bf987e3..c5b4f279b54ee16bf80b34ba336c090643b68837 100644 (file)
@@ -5,12 +5,17 @@ class NodeController < ApplicationController
 
   def create
     if request.put?
 
   def create
     if request.put?
-      node = Node.from_xml(request.raw_post, true)
+      node = nil
+      begin
+        node = Node.from_xml(request.raw_post, true)
+      rescue
+        render :text => "XML didn't parse", :status => 400 # if we got here the doc didnt parse
+        return
+      end
 
       if node
         node.user_id = @user.id
         if node.save_with_history
 
       if node
         node.user_id = @user.id
         if node.save_with_history
-
           render :text => node.id
         else
           render :nothing => true, :status => 500
           render :text => node.id
         else
           render :nothing => true, :status => 500