diff --git a/lib/liquid/context.rb b/lib/liquid/context.rb index 5b1a01ee1..5e1c78473 100644 --- a/lib/liquid/context.rb +++ b/lib/liquid/context.rb @@ -93,11 +93,12 @@ def pop_interrupt end def handle_error(e, line_number = nil) - e = internal_error unless e.is_a?(Liquid::Error) - e.template_name ||= template_name - e.line_number ||= line_number - errors.push(e) - exception_renderer.call(e).to_s + error = internal_error unless e.is_a?(Liquid::Error) + error.template_name ||= template_name + error.line_number ||= line_number + error.original_error = e + errors.push(error) + exception_renderer.call(error).to_s end def invoke(method, *args) diff --git a/lib/liquid/errors.rb b/lib/liquid/errors.rb index 832341d76..05d9a55c2 100644 --- a/lib/liquid/errors.rb +++ b/lib/liquid/errors.rb @@ -5,6 +5,7 @@ class Error < ::StandardError attr_accessor :line_number attr_accessor :template_name attr_accessor :markup_context + attr_accessor :original_error def to_s(with_prefix = true) str = +""