-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
render template name with Liquid Syntax errors #1695
Conversation
e4ecca4
to
49d5b36
Compare
lib/liquid/partial_cache.rb
Outdated
partial.name ||= template_name | ||
begin | ||
partial = template.parse(source, parse_context) | ||
partial.name ||= template_name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick: This line could be moved after the rescue to make it clearer that template.parse
is the only thing we need the rescue for.
) | ||
end | ||
|
||
def test_syntax_error_is_raised_with_actual_filenmae |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is at least a typo here in filename
.
Also, with_actual_filename
isn't really accurate, since it isn't the actual on disk file path (not does liquid itself even know that). You use with_template_name
in a following test which seems more appropriate
def test_syntax_error_is_raised_with_actual_filenmae | |
def test_syntax_error_is_raised_with_template_name |
) | ||
end | ||
|
||
def test_stack_level_error_is_raised_with_actual_filenmae |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def test_stack_level_error_is_raised_with_actual_filenmae | |
def test_stack_level_error_is_raised_with_template_name |
49d5b36
to
e61dc3d
Compare
e61dc3d
to
1d97389
Compare
What are you trying to solve?
When there is a syntax error from a template, the Liquid error message would have a wrong filename:
Liquid:
Error
How are you solving this?
In
PartialCache
, rescue Liquid errors from aLiquid#parse
and assigntemplate_name
to it.After: