]> git.openstreetmap.org Git - rails.git/blobdiff - app/controllers/relation_controller.rb
api06: Move version-checking into the models, raising an exception on mismatch
[rails.git] / app / controllers / relation_controller.rb
index d7b9de13cb6589cad3589e68396648ca7193b001..dabf6eaa8bef7fbe2a1e9710b32c230ca8d7fa2e 100644 (file)
@@ -64,6 +64,9 @@ class RelationController < ApplicationController
       render :nothing => true, :status => :not_found
     rescue OSM::APIPreconditionFailedError
       render :text => "", :status => :precondition_failed
+    rescue OSM::APIVersionMismatchError => ex
+      render :text => "Version mismatch: Provided " + ex.provided.to_s +
+       ", server had: " + ex.latest.to_s, :status => :bad_request
     rescue
       render :nothing => true, :status => :internal_server_error
     end