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:
Dylan Thacker-Smith
2015-05-25 11:24:53 -04:00
parent 070639daba
commit 36200ff704
3 changed files with 13 additions and 3 deletions
+7
View File
@@ -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