aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/middleware
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2010-05-01 02:23:47 -0700
committerXavier Noria <fxn@hashref.com>2010-05-01 02:23:47 -0700
commitefba1d4227514a6ce4880910a6531b0a6c3c75aa (patch)
treedaff4155b8c19b915125ac0b0da458279358e743 /actionpack/lib/action_dispatch/middleware
parent81807e0fe2879e08563c91ee6809ab6d1d0bd081 (diff)
parent6c280f3398966ffba45069500ff43d632513fe44 (diff)
downloadrails-efba1d4227514a6ce4880910a6531b0a6c3c75aa.tar.gz
rails-efba1d4227514a6ce4880910a6531b0a6c3c75aa.tar.bz2
rails-efba1d4227514a6ce4880910a6531b0a6c3c75aa.zip
Merge commit 'rails/master'
Conflicts: railties/guides/source/index.html.erb
Diffstat (limited to 'actionpack/lib/action_dispatch/middleware')
-rw-r--r--actionpack/lib/action_dispatch/middleware/show_exceptions.rb12
1 files changed, 11 insertions, 1 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)