diff options
author | Sean Griffin <sean@seantheprogrammer.com> | 2015-12-14 10:17:42 -0700 |
---|---|---|
committer | Sean Griffin <sean@seantheprogrammer.com> | 2015-12-14 10:17:42 -0700 |
commit | 1dc1c8e40bff1c6ba5fcbec4f325ae6c043e6404 (patch) | |
tree | 34eccfd8e5055476a01117364c90d6c55e174db6 /actionpack/lib/action_dispatch | |
parent | 4ecabed2f65cc899ed2e8858fb1140bca8531ff8 (diff) | |
parent | d3dd3847bc2633ecead36f602bfca21c9362b502 (diff) | |
download | rails-1dc1c8e40bff1c6ba5fcbec4f325ae6c043e6404.tar.gz rails-1dc1c8e40bff1c6ba5fcbec4f325ae6c043e6404.tar.bz2 rails-1dc1c8e40bff1c6ba5fcbec4f325ae6c043e6404.zip |
Merge pull request #22564 from maximeg/legit_name_errors
Don't catch all NameError to reraise as ActionController::RoutingError
Diffstat (limited to 'actionpack/lib/action_dispatch')
-rw-r--r-- | actionpack/lib/action_dispatch/routing/route_set.rb | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/actionpack/lib/action_dispatch/routing/route_set.rb b/actionpack/lib/action_dispatch/routing/route_set.rb index c4228df925..2bd2e53252 100644 --- a/actionpack/lib/action_dispatch/routing/route_set.rb +++ b/actionpack/lib/action_dispatch/routing/route_set.rb @@ -30,9 +30,9 @@ module ActionDispatch controller = controller req res = controller.make_response! req dispatch(controller, params[:action], req, res) - rescue NameError => e + rescue ActionController::RoutingError if @raise_on_name_error - raise ActionController::RoutingError, e.message, e.backtrace + raise else return [404, {'X-Cascade' => 'pass'}, []] end @@ -42,6 +42,8 @@ module ActionDispatch def controller(req) req.controller_class + rescue NameError => e + raise ActionController::RoutingError, e.message, e.backtrace end def dispatch(controller, action, req, res) |