From 2ab2077235308aaa82dc430f1da8d6519fb7dac0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Sat, 3 Dec 2011 11:38:25 +0100 Subject: Fix failing cascade exception. --- actionpack/lib/action_dispatch/middleware/debug_exceptions.rb | 3 ++- actionpack/lib/action_dispatch/middleware/show_exceptions.rb | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'actionpack/lib') diff --git a/actionpack/lib/action_dispatch/middleware/debug_exceptions.rb b/actionpack/lib/action_dispatch/middleware/debug_exceptions.rb index 5da21ddd3d..417701ea54 100644 --- a/actionpack/lib/action_dispatch/middleware/debug_exceptions.rb +++ b/actionpack/lib/action_dispatch/middleware/debug_exceptions.rb @@ -15,6 +15,7 @@ module ActionDispatch begin response = @app.call(env) + # TODO: Maybe this should be in the router itself if response[1]['X-Cascade'] == 'pass' raise ActionController::RoutingError, "No route matches [#{env['REQUEST_METHOD']}] #{env['PATH_INFO'].inspect}" end @@ -22,7 +23,7 @@ module ActionDispatch raise exception if env['action_dispatch.show_exceptions'] == false end - response ? response : render_exception(env, exception) + exception ? render_exception(env, exception) : response end private diff --git a/actionpack/lib/action_dispatch/middleware/show_exceptions.rb b/actionpack/lib/action_dispatch/middleware/show_exceptions.rb index 9efe90a670..0c95248611 100644 --- a/actionpack/lib/action_dispatch/middleware/show_exceptions.rb +++ b/actionpack/lib/action_dispatch/middleware/show_exceptions.rb @@ -40,7 +40,7 @@ module ActionDispatch raise exception if env['action_dispatch.show_exceptions'] == false end - response ? response : render_exception_with_failsafe(env, exception) + response || render_exception_with_failsafe(env, exception) end private -- cgit v1.2.3