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

Render tag error reporting fix #1669

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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions lib/liquid/tags/render.rb
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ def render_tag(context, output)
end

output
rescue SyntaxError => e
e.template_name ||= template_name
raise
end

class ParseTreeVisitor < Liquid::ParseTreeVisitor
Expand Down
12 changes: 12 additions & 0 deletions test/integration/tags/render_tag_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -206,4 +206,16 @@ def test_render_tag_with_drop
'loop' => "{{ value }}",
})
end

def test_render_reports_error_in_correct_template
assert_template_result(
"Liquid syntax error (inner_partial line 2): Unknown tag 'undefined_tag'",
'{% render "outer_partial" %}',
partials: {
'outer_partial' => '{% render "inner_partial" %}',
'inner_partial' => "\n{% undefined_tag %}",
},
render_errors: true
)
end
end