Revert "Ensure original exception message is present in both Template::Error#message and Template::Error#inspect."

This reverts commit 403b06e98e.

The call to `message` calls `inspect` on our exception.  The exception
holds a reference to the environment, and the controller.  This string
becomes very large, and the call to `super` dups the string (in tern
doubling the memory used).  I'm reverting this for 3.1 but leaving the
commit on master.  We should stop holding references to so many objects
and reduce the size of our inspect.
This commit is contained in:
Aaron Patterson
2011-08-10 14:37:56 -07:00
parent 47c6a77180
commit cdf6251c0b
2 changed files with 4 additions and 14 deletions

View File

@@ -58,7 +58,6 @@ 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
@@ -68,6 +67,10 @@ module ActionView
@template.identifier
end
def message
original_exception.message
end
def sub_template_message
if @sub_templates
"Trace of template inclusion: " +

View File

@@ -1,13 +0,0 @@
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