1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Merge branch 'template_error' into merge

* template_error:
  Ensure original exception message is present in both Template::Error#message and Template::Error#inspect.
  ActiveSupport::Deprecation.silence no longer needed.
This commit is contained in:
Aaron Patterson 2011-01-18 10:52:37 -08:00
commit 54de7048a5
2 changed files with 14 additions and 4 deletions

View file

@ -56,6 +56,7 @@ module ActionView
attr_reader :original_exception, :backtrace
def initialize(template, assigns, original_exception)
super(original_exception.message)
@template, @assigns, @original_exception = template, assigns.dup, original_exception
@sub_templates = nil
@backtrace = original_exception.backtrace
@ -65,10 +66,6 @@ module ActionView
@template.identifier
end
def message
ActiveSupport::Deprecation.silence { original_exception.message }
end
def sub_template_message
if @sub_templates
"Trace of template inclusion: " +

View file

@ -0,0 +1,13 @@
require "abstract_unit"
class TemplateErrorTest < ActiveSupport::TestCase
def test_provides_original_message
error = ActionView::Template::Error.new("test", {}, Exception.new("original"))
assert_equal "original", error.message
end
def test_provides_useful_inspect
error = ActionView::Template::Error.new("test", {}, Exception.new("original"))
assert_equal "#<ActionView::Template::Error: original>", error.inspect
end
end