From: Tom Hughes Date: Wed, 2 Oct 2024 17:36:03 +0000 (+0100) Subject: Merge remote-tracking branch 'upstream/pull/5245' X-Git-Tag: live~559 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/ad2e50fcfb7aab6cb6bbf5518920e4091be5b9a4?hp=-c Merge remote-tracking branch 'upstream/pull/5245' --- ad2e50fcfb7aab6cb6bbf5518920e4091be5b9a4 diff --combined app/controllers/api_controller.rb index 84398ad61,6ce8a0ef2..17c98fe8b --- a/app/controllers/api_controller.rb +++ b/app/controllers/api_controller.rb @@@ -3,6 -3,8 +3,8 @@@ class ApiController < ApplicationContro before_action :check_api_readable + around_action :api_call_handle_error, :api_call_timeout + private ## @@@ -132,7 -134,7 +134,7 @@@ report_error message, :bad_request rescue OSM::APIError => e report_error e.message, e.status - rescue AbstractController::ActionNotFound => e + rescue AbstractController::ActionNotFound, CanCan::AccessDenied => e raise rescue StandardError => e logger.info("API threw unexpected #{e.class} exception: #{e.message}") @@@ -142,8 -144,8 +144,8 @@@ ## # wrap an api call in a timeout - def api_call_timeout(&block) - Timeout.timeout(Settings.api_timeout, &block) + def api_call_timeout(&) + Timeout.timeout(Settings.api_timeout, &) rescue ActionView::Template::Error => e e = e.cause