aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/lib/action_dispatch')
-rw-r--r--actionpack/lib/action_dispatch/middleware/show_exceptions.rb12
-rw-r--r--actionpack/lib/action_dispatch/routing/route_set.rb5
2 files changed, 11 insertions, 6 deletions
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)
diff --git a/actionpack/lib/action_dispatch/routing/route_set.rb b/actionpack/lib/action_dispatch/routing/route_set.rb
index fdbff74071..0d071dd7fe 100644
--- a/actionpack/lib/action_dispatch/routing/route_set.rb
+++ b/actionpack/lib/action_dispatch/routing/route_set.rb
@@ -6,10 +6,6 @@ require 'action_dispatch/routing/deprecated_mapper'
module ActionDispatch
module Routing
class RouteSet #:nodoc:
- NotFound = lambda { |env|
- raise ActionController::RoutingError, "No route matches #{env['PATH_INFO'].inspect}"
- }
-
PARAMETERS_KEY = 'action_dispatch.request.path_parameters'
class Dispatcher #:nodoc:
@@ -224,7 +220,6 @@ module ActionDispatch
def finalize!
return if @finalized
@finalized = true
- @set.add_route(NotFound)
@set.freeze
end