aboutsummaryrefslogtreecommitdiffstats
path: root/actionview
diff options
context:
space:
mode:
authorGenadi Samokovarov <gsamokovarov@gmail.com>2015-12-23 17:14:12 +0200
committerGenadi Samokovarov <gsamokovarov@gmail.com>2015-12-23 17:14:12 +0200
commit3f93888808442c014eab31ba31151daeafa76f1f (patch)
treee8a0da3191068e78da2234e8275100ae13b275cd /actionview
parentc3989819eaa8ff0be852f86f83a221bb11ffbcc3 (diff)
downloadrails-3f93888808442c014eab31ba31151daeafa76f1f.tar.gz
rails-3f93888808442c014eab31ba31151daeafa76f1f.tar.bz2
rails-3f93888808442c014eab31ba31151daeafa76f1f.zip
Fix edge case with ActionView::Template::Error reraise
When you re-raise an ActionView::Template::Error, the #cause can change. You can see this behaviour with [nack]. Currently, `web-console` doesn't run the console in the proper binding in the case of errors in the views, because when we follow the `#cause` of the exception it is an [`EOFError`][EOFError]. This also affects [pow] as it runs on [nack]. [nack]: https://github.com/josh/nack [pow]: http://pow.cx/ [EOFError]: https://github.com/josh/nack/blob/d523cc870c0a11dcf349388a15adfecba9314f97/lib/nack/server.rb#L108
Diffstat (limited to 'actionview')
-rw-r--r--actionview/lib/action_view/template/error.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/actionview/lib/action_view/template/error.rb b/actionview/lib/action_view/template/error.rb
index b03b197cb5..ccee785d3e 100644
--- a/actionview/lib/action_view/template/error.rb
+++ b/actionview/lib/action_view/template/error.rb
@@ -59,6 +59,9 @@ module ActionView
class Error < ActionViewError #:nodoc:
SOURCE_CODE_RADIUS = 3
+ # Override to prevent #cause resetting during re-raise.
+ attr_reader :cause
+
def initialize(template, original_exception = nil)
if original_exception
ActiveSupport::Deprecation.warn("Passing #original_exception is deprecated and has no effect. " \
@@ -67,6 +70,7 @@ module ActionView
super($!.message)
set_backtrace($!.backtrace)
+ @cause = $!
@template, @sub_templates = template, nil
end