diff options
-rw-r--r-- | actionpack/lib/action_view/template/error.rb | 5 | ||||
-rw-r--r-- | actionpack/test/template/template_error_test.rb | 13 |
2 files changed, 14 insertions, 4 deletions
diff --git a/actionpack/lib/action_view/template/error.rb b/actionpack/lib/action_view/template/error.rb index 3c7380ee19..c3d5aca6ac 100644 --- a/actionpack/lib/action_view/template/error.rb +++ b/actionpack/lib/action_view/template/error.rb @@ -52,6 +52,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 @@ -61,10 +62,6 @@ module ActionView @template.identifier end - def message - original_exception.message - end - def sub_template_message if @sub_templates "Trace of template inclusion: " + diff --git a/actionpack/test/template/template_error_test.rb b/actionpack/test/template/template_error_test.rb new file mode 100644 index 0000000000..3a874082d9 --- /dev/null +++ b/actionpack/test/template/template_error_test.rb @@ -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 |