FIX: `rescue_from` doesn't bubble up.
See a47e0c19e6/actionpack/lib/action_controller/metal/rescue.rb (L25)
This commit is contained in:
parent
253a185769
commit
26c7fa2c29
|
@ -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,7 +212,9 @@ class ApplicationController < ActionController::Base
|
|||
end
|
||||
|
||||
rescue_from Discourse::ReadOnly do
|
||||
render_json_error I18n.t('read_only_mode_enabled'), type: :read_only, status: 503
|
||||
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)
|
||||
|
|
Loading…
Reference in New Issue