mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
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:
@@ -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: " +
|
||||
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user