aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/middleware/show_exceptions.rb
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2015-08-06 16:12:06 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2015-08-06 16:12:06 -0700
commit6716ad555a687b1e825fa71ba076e641f4dc097a (patch)
treed1e1de26ff578673256183bd72e9eb796448bb8a /actionpack/lib/action_dispatch/middleware/show_exceptions.rb
parent6d85804bc6aeecce5669fb4b0d7b33c069deff3a (diff)
downloadrails-6716ad555a687b1e825fa71ba076e641f4dc097a.tar.gz
rails-6716ad555a687b1e825fa71ba076e641f4dc097a.tar.bz2
rails-6716ad555a687b1e825fa71ba076e641f4dc097a.zip
ask the request if we should show exceptions
hide the env key in the request object so that other code doesn't need to know.
Diffstat (limited to 'actionpack/lib/action_dispatch/middleware/show_exceptions.rb')
-rw-r--r--actionpack/lib/action_dispatch/middleware/show_exceptions.rb7
1 files changed, 4 insertions, 3 deletions
diff --git a/actionpack/lib/action_dispatch/middleware/show_exceptions.rb b/actionpack/lib/action_dispatch/middleware/show_exceptions.rb
index a764a1aea5..12d8dab8eb 100644
--- a/actionpack/lib/action_dispatch/middleware/show_exceptions.rb
+++ b/actionpack/lib/action_dispatch/middleware/show_exceptions.rb
@@ -27,12 +27,13 @@ module ActionDispatch
end
def call(env)
+ request = ActionDispatch::Request.new env
@app.call(env)
rescue Exception => exception
- if env['action_dispatch.show_exceptions'] == false
- raise exception
- else
+ if request.show_exceptions?
render_exception(env, exception)
+ else
+ raise exception
end
end