mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-15 08:50:45 -07:00
Make liquid error rendering optional.
Although the author of the liquid template wants to see these errors, they probably don't want the visitor to see the liquid errors. Probably the best fallback when rendering the page for visitors is to render the empty string for tags with errors.
This commit is contained in:
@@ -185,4 +185,11 @@ class ErrorHandlingTest < Minitest::Test
|
||||
template.render('errors' => ErrorDrop.new)
|
||||
end
|
||||
end
|
||||
|
||||
def test_disabling_error_rendering
|
||||
template = Liquid::Template.parse('This is an argument error: {{ errors.argument_error }}')
|
||||
template.render_errors = false
|
||||
assert_equal 'This is an argument error: ', template.render('errors' => ErrorDrop.new)
|
||||
assert_equal [ArgumentError], template.errors.map(&:class)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user