diff options
author | Neeraj Singh <neerajdotname@gmail.com> | 2010-06-08 11:59:09 -0400 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-07-19 14:50:38 +0200 |
commit | 33c5689e2d04aa08759903bc5d1e4de3bf6c35dd (patch) | |
tree | c8dd5917a8dd10017d7a653567ff084a5dfa18ab /actionpack/lib/action_controller/metal/rescue_with_helper.rb | |
parent | ad8f4dfc50fe3858b80aeceb6d9240d2af4a2fea (diff) | |
download | rails-33c5689e2d04aa08759903bc5d1e4de3bf6c35dd.tar.gz rails-33c5689e2d04aa08759903bc5d1e4de3bf6c35dd.tar.bz2 rails-33c5689e2d04aa08759903bc5d1e4de3bf6c35dd.zip |
Exceptions from views should be rescued based on the original exception. If a handler for original exception is missing then apply ActiveView::TemplateError
[#2034 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
Diffstat (limited to 'actionpack/lib/action_controller/metal/rescue_with_helper.rb')
-rw-r--r-- | actionpack/lib/action_controller/metal/rescue_with_helper.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/actionpack/lib/action_controller/metal/rescue_with_helper.rb b/actionpack/lib/action_controller/metal/rescue_with_helper.rb new file mode 100644 index 0000000000..7894deaeef --- /dev/null +++ b/actionpack/lib/action_controller/metal/rescue_with_helper.rb @@ -0,0 +1,14 @@ +module ActionController #:nodoc: + module RescueWithHelper + + def rescue_with_handler(exception) + if ((exception.class == ActionView::TemplateError) && + (orig_exception = exception.original_exception) && + (orig_handler = handler_for_rescue(orig_exception))) + exception = orig_exception + end + super(exception) + end + + end +end |