From 6c280f3398966ffba45069500ff43d632513fe44 Mon Sep 17 00:00:00 2001 From: Carl Lerche Date: Fri, 30 Apr 2010 16:40:42 -0700 Subject: RouteSet does not raise ActionController::RoutingError when no routes match anymore. Instead, it follows the X-Cascade convention. ShowExceptions checks for X-Cascade so that the routing error page can still be displayed. --- actionpack/lib/action_dispatch/middleware/show_exceptions.rb | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'actionpack/lib/action_dispatch/middleware') diff --git a/actionpack/lib/action_dispatch/middleware/show_exceptions.rb b/actionpack/lib/action_dispatch/middleware/show_exceptions.rb index 43440e5f7c..12a93d6a24 100644 --- a/actionpack/lib/action_dispatch/middleware/show_exceptions.rb +++ b/actionpack/lib/action_dispatch/middleware/show_exceptions.rb @@ -45,7 +45,17 @@ module ActionDispatch end def call(env) - @app.call(env) + status, headers, body = @app.call(env) + + # Only this middleware cares about RoutingError. So, let's just raise + # it here. + # TODO: refactor this middleware to handle the X-Cascade scenario without + # having to raise an exception. + if headers['X-Cascade'] == 'pass' + raise ActionController::RoutingError, "No route matches #{env['PATH_INFO'].inspect}" + end + + [status, headers, body] rescue Exception => exception raise exception if env['action_dispatch.show_exceptions'] == false render_exception(env, exception) -- cgit v1.2.3