Module: RailsHush::ShowExceptions

Included in:
HushOne, HushTwo
Defined in:
lib/rails_hush/middleware/show_exceptions.rb

Constant Summary collapse

SHOWABLE =

actionpack treats missing/invalid values as :all/true. since railties (eg: a full rails app) defaults to :all, skipping the invalid value case here to improve code clarity. since rails-hush intentionally overrides certain exceptions, treat :rescuable the same as :all. there's no need to be dynamic here.

[
  :all,       # rails 7.1+
  true,       # rails 7.0-
  nil,        # equiv to :all,true
  :rescuable  # rails 7.1+
]

Instance Method Summary collapse

Instance Method Details

#show_exceptions?(request, exception = nil) ⇒ Boolean



15
16
17
18
19
20
21
# File 'lib/rails_hush/middleware/show_exceptions.rb', line 15

def show_exceptions?(request, exception=nil)
  if Rails.version >= '7.1'
    SHOWABLE.include? request.get_header("action_dispatch.show_exceptions")
  else
    request.show_exceptions?
  end
end