diff options
author | Les Hill and Sandro Turriate <dev+leshill+sandro@hashrocket.com> | 2010-10-11 10:55:07 -0400 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-10-12 00:56:07 +0200 |
commit | dde54f00c6c08d1704d011d8108106076e8ea033 (patch) | |
tree | e72ea57570e209e88c5431f040b2f8d9634c461b /actionpack/lib | |
parent | 0d3333257156544feba729ba28f6874d5a30d561 (diff) | |
download | rails-dde54f00c6c08d1704d011d8108106076e8ea033.tar.gz rails-dde54f00c6c08d1704d011d8108106076e8ea033.tar.bz2 rails-dde54f00c6c08d1704d011d8108106076e8ea033.zip |
Show exceptions rescues the original exception
[#5784 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_dispatch/middleware/show_exceptions.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/actionpack/lib/action_dispatch/middleware/show_exceptions.rb b/actionpack/lib/action_dispatch/middleware/show_exceptions.rb index ef0c9c51f5..71e736ce9f 100644 --- a/actionpack/lib/action_dispatch/middleware/show_exceptions.rb +++ b/actionpack/lib/action_dispatch/middleware/show_exceptions.rb @@ -62,6 +62,7 @@ module ActionDispatch private def render_exception(env, exception) log_error(exception) + exception = original_exception(exception) request = Request.new(env) if @consider_all_requests_local || request.local? @@ -154,5 +155,17 @@ module ActionDispatch def logger defined?(Rails.logger) ? Rails.logger : Logger.new($stderr) end + + def original_exception(exception) + if registered_original_exception?(exception) + exception.original_exception + else + exception + end + end + + def registered_original_exception?(exception) + exception.respond_to?(:original_exception) && @@rescue_responses.has_key?(exception.original_exception.class.name) + end end end |