mirror of
https://github.com/kemko/liquid.git
synced 2026-01-01 15:55:40 +03:00
Parse time errors should propagate to calling site
This commit is contained in:
@@ -42,10 +42,12 @@ module Liquid
|
||||
def handle_error(e)
|
||||
errors.push(e)
|
||||
raise if @rethrow_errors
|
||||
|
||||
|
||||
case e
|
||||
when SyntaxError then "Liquid syntax error: #{e.message}"
|
||||
else "Liquid error: #{e.message}"
|
||||
when SyntaxError
|
||||
"Liquid syntax error: #{e.message}"
|
||||
else
|
||||
"Liquid error: #{e.message}"
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -59,15 +59,11 @@ class ErrorHandlingTest < Test::Unit::TestCase
|
||||
|
||||
end
|
||||
|
||||
def test_missing_endtag
|
||||
def test_missing_endtag_parse_time_error
|
||||
|
||||
assert_nothing_raised do
|
||||
assert_raise(Liquid::SyntaxError) do
|
||||
|
||||
template = Liquid::Template.parse(' {% for a in b %} ... ')
|
||||
assert_equal ' Liquid error: Unknown operator =! ', template.render
|
||||
|
||||
assert_equal 1, template.errors.size
|
||||
assert_equal Liquid::SyntaxError, template.errors.first.class
|
||||
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user