FIX: `rescue_from` doesn't bubble up.

See a47e0c19e6/actionpack/lib/action_controller/metal/rescue.rb (L25)
This commit is contained in:
Guo Xiang Tan 2020-05-26 22:43:29 +08:00
parent 253a185769
commit 26c7fa2c29
No known key found for this signature in database
GPG Key ID: FBD110179AAC1F20
1 changed files with 4 additions and 2 deletions

View File

@ -124,7 +124,7 @@ class ApplicationController < ActionController::Base
rescue_from PG::ReadOnlySqlTransaction do |e|
Discourse.received_postgres_readonly!
Rails.logger.error("#{e.class} #{e.message}: #{e.backtrace.join("\n")}")
raise Discourse::ReadOnly
rescue_with_handler(Discourse::ReadOnly.new) || raise
end
rescue_from ActionController::ParameterMissing do |e|
@ -212,8 +212,10 @@ class ApplicationController < ActionController::Base
end
rescue_from Discourse::ReadOnly do
unless response_body
render_json_error I18n.t('read_only_mode_enabled'), type: :read_only, status: 503
end
end
def redirect_with_client_support(url, options)
if request.xhr?