From 33c5689e2d04aa08759903bc5d1e4de3bf6c35dd Mon Sep 17 00:00:00 2001 From: Neeraj Singh Date: Tue, 8 Jun 2010 11:59:09 -0400 Subject: Exceptions from views should be rescued based on the original exception. If a handler for original exception is missing then apply ActiveView::TemplateError MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [#2034 state:resolved] Signed-off-by: José Valim --- .../lib/action_controller/metal/rescue_with_helper.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 actionpack/lib/action_controller/metal/rescue_with_helper.rb (limited to 'actionpack/lib/action_controller/metal') 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 -- cgit v1.2.3