Skip to content
Browse files

remove begin-rescue in favor of def-rescue

  • Loading branch information...
1 parent cc24eba commit d73cc03010d8c936fbcbbf8a77e15c9724872310 @goshakkk goshakkk committed
Showing with 9 additions and 10 deletions.
  1. +9 −10 actionpack/lib/action_dispatch/middleware/debug_exceptions.rb
View
19 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 d73cc03

Please sign in to comment.
Something went wrong with that request. Please try again.