aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2015-08-23 17:25:13 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2015-08-23 17:25:13 -0700
commit9503e65b9718e4f01860cf017c1cdcdccdfffde7 (patch)
tree53ace14ee0582b35e84f6502dd0bddde0d2b4590 /actionpack/lib
parent71d0b61f3a5e894481a67c92a461653f6db21723 (diff)
downloadrails-9503e65b9718e4f01860cf017c1cdcdccdfffde7.tar.gz
rails-9503e65b9718e4f01860cf017c1cdcdccdfffde7.tar.bz2
rails-9503e65b9718e4f01860cf017c1cdcdccdfffde7.zip
use methods on the request object instead of accessing env
Diffstat (limited to 'actionpack/lib')
-rw-r--r--actionpack/lib/action_dispatch/middleware/show_exceptions.rb14
1 files changed, 7 insertions, 7 deletions
diff --git a/actionpack/lib/action_dispatch/middleware/show_exceptions.rb b/actionpack/lib/action_dispatch/middleware/show_exceptions.rb
index 12d8dab8eb..64695f9738 100644
--- a/actionpack/lib/action_dispatch/middleware/show_exceptions.rb
+++ b/actionpack/lib/action_dispatch/middleware/show_exceptions.rb
@@ -31,7 +31,7 @@ module ActionDispatch
@app.call(env)
rescue Exception => exception
if request.show_exceptions?
- render_exception(env, exception)
+ render_exception(request, exception)
else
raise exception
end
@@ -39,14 +39,14 @@ module ActionDispatch
private
- def render_exception(env, exception)
- backtrace_cleaner = env['action_dispatch.backtrace_cleaner']
+ def render_exception(request, exception)
+ backtrace_cleaner = request.get_header 'action_dispatch.backtrace_cleaner'
wrapper = ExceptionWrapper.new(backtrace_cleaner, exception)
status = wrapper.status_code
- env["action_dispatch.exception"] = wrapper.exception
- env["action_dispatch.original_path"] = env["PATH_INFO"]
- env["PATH_INFO"] = "/#{status}"
- response = @exceptions_app.call(env)
+ request.set_header "action_dispatch.exception", wrapper.exception
+ request.set_header "action_dispatch.original_path", request.path_info
+ request.path_info = "/#{status}"
+ response = @exceptions_app.call(request.env)
response[1]['X-Cascade'] == 'pass' ? pass_response(status) : response
rescue Exception => failsafe_error
$stderr.puts "Error during failsafe response: #{failsafe_error}\n #{failsafe_error.backtrace * "\n "}"