]> git.openstreetmap.org Git - rails.git/blobdiff - app/controllers/user_preference_controller.rb
Fixed 'raw' raises by converting them to the appropriate OSM::APIError type. Made...
[rails.git] / app / controllers / user_preference_controller.rb
index 3b56c257be32b822864b08f984c959d8f549fc27..59573047acc3591e22621f1fb041b99abe3f95d9 100644 (file)
@@ -52,8 +52,11 @@ class UserPreferenceController < ApplicationController
 
   # update the entire set of preferences
   def update
-    p = XML::Parser.new
-    p.string = request.raw_post
+    begin
+      p = XML::Parser.string(request.raw_post)
+    rescue LibXML::XML::Error, ArgumentError => ex
+      raise OSM::APIBadXMLError.new("preferences", xml, ex.message)
+    end
     doc = p.parse
 
     prefs = []