mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
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]: d523cc870c/lib/nack/server.rb (L108)
This commit is contained in:
parent
c3989819ea
commit
3f93888808
1 changed files with 4 additions and 0 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue