Permalink
Browse files

Merge pull request #8788 from goshakkk/remove-begin-rescue

Remove begin-rescue in favor of def-rescue
  • Loading branch information...
fxn committed Jan 7, 2013
2 parents 2c9d129 + d73cc03 commit f5da2e82c230210cc7389524d3b6eb404ec0e865
Showing with 9 additions and 10 deletions.
  1. +9 −10 actionpack/lib/action_dispatch/middleware/debug_exceptions.rb
@@ -14,18 +14,17 @@ def initialize(app, routes_app = nil)
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

0 comments on commit f5da2e8

Please sign in to comment.