mirror of
https://github.com/discourse/discourse.git
synced 2025-03-09 14:34:35 +00:00
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|
|
rescue_from PG::ReadOnlySqlTransaction do |e|
|
||||||
Discourse.received_postgres_readonly!
|
Discourse.received_postgres_readonly!
|
||||||
Rails.logger.error("#{e.class} #{e.message}: #{e.backtrace.join("\n")}")
|
Rails.logger.error("#{e.class} #{e.message}: #{e.backtrace.join("\n")}")
|
||||||
raise Discourse::ReadOnly
|
rescue_with_handler(Discourse::ReadOnly.new) || raise
|
||||||
end
|
end
|
||||||
|
|
||||||
rescue_from ActionController::ParameterMissing do |e|
|
rescue_from ActionController::ParameterMissing do |e|
|
||||||
@ -212,8 +212,10 @@ class ApplicationController < ActionController::Base
|
|||||||
end
|
end
|
||||||
|
|
||||||
rescue_from Discourse::ReadOnly do
|
rescue_from Discourse::ReadOnly do
|
||||||
|
unless response_body
|
||||||
render_json_error I18n.t('read_only_mode_enabled'), type: :read_only, status: 503
|
render_json_error I18n.t('read_only_mode_enabled'), type: :read_only, status: 503
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def redirect_with_client_support(url, options)
|
def redirect_with_client_support(url, options)
|
||||||
if request.xhr?
|
if request.xhr?
|
||||||
|
Loading…
x
Reference in New Issue
Block a user