X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/46bc4650d2123a2233e62f0e101983552178d12a..cbea796ef412840af9a3ec2fd26bf08657fc4cd3:/app/controllers/api/amf_controller.rb diff --git a/app/controllers/api/amf_controller.rb b/app/controllers/api/amf_controller.rb index 2a878d248..0f368c3dc 100644 --- a/app/controllers/api/amf_controller.rb +++ b/app/controllers/api/amf_controller.rb @@ -36,10 +36,9 @@ # * version conflict when POIs and ways are reverted module Api - class AmfController < ApplicationController + class AmfController < ApiController include Potlatch - skip_before_action :verify_authenticity_token before_action :check_api_writable # AMF Controller implements its own authentication and authorization checks @@ -115,23 +114,23 @@ module Api def amf_handle_error(call, rootobj, rootid) yield - rescue OSM::APIAlreadyDeletedError => ex - [-4, ex.object, ex.object_id] - rescue OSM::APIVersionMismatchError => ex - [-3, [rootobj, rootid], [ex.type.downcase, ex.id, ex.latest]] - rescue OSM::APIUserChangesetMismatchError => ex - [-2, ex.to_s] - rescue OSM::APIBadBoundingBox => ex - [-2, "Sorry - I can't get the map for that area. The server said: #{ex}"] - rescue OSM::APIError => ex - [-1, ex.to_s] - rescue StandardError => ex - [-2, "An unusual error happened (in #{call}). The server said: #{ex}"] + rescue OSM::APIAlreadyDeletedError => e + [-4, e.object, e.object_id] + rescue OSM::APIVersionMismatchError => e + [-3, [rootobj, rootid], [e.type.downcase, e.id, e.latest]] + rescue OSM::APIUserChangesetMismatchError => e + [-2, e.to_s] + rescue OSM::APIBadBoundingBox => e + [-2, "Sorry - I can't get the map for that area. The server said: #{e}"] + rescue OSM::APIError => e + [-1, e.to_s] + rescue StandardError => e + [-2, "An unusual error happened (in #{call}). The server said: #{e}"] end def amf_handle_error_with_timeout(call, rootobj, rootid) amf_handle_error(call, rootobj, rootid) do - OSM::Timer.timeout(API_TIMEOUT, OSM::APITimeoutError) do + OSM::Timer.timeout(Settings.api_timeout, OSM::APITimeoutError) do yield end end