diff options
author | Xavier Noria <fxn@hashref.com> | 2013-01-07 00:33:45 -0800 |
---|---|---|
committer | Xavier Noria <fxn@hashref.com> | 2013-01-07 00:33:45 -0800 |
commit | f5da2e82c230210cc7389524d3b6eb404ec0e865 (patch) | |
tree | 51a3b9b5f858773cab655874a01d44fd8e09f41f /actionpack/lib | |
parent | 2c9d129fb46129bc7df38c26f3b79cd927cc14fb (diff) | |
parent | d73cc03010d8c936fbcbbf8a77e15c9724872310 (diff) | |
download | rails-f5da2e82c230210cc7389524d3b6eb404ec0e865.tar.gz rails-f5da2e82c230210cc7389524d3b6eb404ec0e865.tar.bz2 rails-f5da2e82c230210cc7389524d3b6eb404ec0e865.zip |
Merge pull request #8788 from goshakkk/remove-begin-rescue
Remove begin-rescue in favor of def-rescue
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_dispatch/middleware/debug_exceptions.rb | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/actionpack/lib/action_dispatch/middleware/debug_exceptions.rb b/actionpack/lib/action_dispatch/middleware/debug_exceptions.rb index f897d9b0bc..64230ff1ae 100644 --- a/actionpack/lib/action_dispatch/middleware/debug_exceptions.rb +++ b/actionpack/lib/action_dispatch/middleware/debug_exceptions.rb @@ -14,18 +14,17 @@ module ActionDispatch end def call(env) - begin - _, headers, body = response = @app.call(env) - - if headers['X-Cascade'] == 'pass' - body.close if body.respond_to?(:close) - raise ActionController::RoutingError, "No route matches [#{env['REQUEST_METHOD']}] #{env['PATH_INFO'].inspect}" - end - rescue Exception => exception - raise exception if env['action_dispatch.show_exceptions'] == false + _, headers, body = response = @app.call(env) + + if headers['X-Cascade'] == 'pass' + body.close if body.respond_to?(:close) + raise ActionController::RoutingError, "No route matches [#{env['REQUEST_METHOD']}] #{env['PATH_INFO'].inspect}" end - exception ? render_exception(env, exception) : response + response + rescue Exception => exception + raise exception if env['action_dispatch.show_exceptions'] == false + render_exception(env, exception) end private |