Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Save original error at internal error. #1736

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 6 additions & 5 deletions lib/liquid/context.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions lib/liquid/errors.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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 = +""
Expand Down