Compare commits

...
Author SHA1 Message Date
Michael Go 7b25b770af add new TemplateEncodingError 2024-01-12 12:17:20 -04:00
3 changed files with 19 additions and 18 deletions
+16 -15
View File
@@ -40,19 +40,20 @@ module Liquid
end
end
ArgumentError = Class.new(Error)
ContextError = Class.new(Error)
FileSystemError = Class.new(Error)
StandardError = Class.new(Error)
SyntaxError = Class.new(Error)
StackLevelError = Class.new(Error)
MemoryError = Class.new(Error)
ZeroDivisionError = Class.new(Error)
FloatDomainError = Class.new(Error)
UndefinedVariable = Class.new(Error)
UndefinedDropMethod = Class.new(Error)
UndefinedFilter = Class.new(Error)
MethodOverrideError = Class.new(Error)
DisabledError = Class.new(Error)
InternalError = Class.new(Error)
ArgumentError = Class.new(Error)
ContextError = Class.new(Error)
FileSystemError = Class.new(Error)
StandardError = Class.new(Error)
SyntaxError = Class.new(Error)
StackLevelError = Class.new(Error)
MemoryError = Class.new(Error)
ZeroDivisionError = Class.new(Error)
FloatDomainError = Class.new(Error)
UndefinedVariable = Class.new(Error)
UndefinedDropMethod = Class.new(Error)
UndefinedFilter = Class.new(Error)
MethodOverrideError = Class.new(Error)
DisabledError = Class.new(Error)
InternalError = Class.new(Error)
TemplateEncodingError = Class.new(Error)
end
+1 -1
View File
@@ -109,7 +109,7 @@ module Liquid
parse_context = configure_options(options)
unless source.valid_encoding?
raise SyntaxError, parse_context.locale.t("errors.syntax.invalid_template_encoding")
raise TemplateEncodingError, parse_context.locale.t("errors.syntax.invalid_template_encoding")
end
tokenizer = parse_context.new_tokenizer(source, start_line_number: @line_numbers && 1)
+2 -2
View File
@@ -339,7 +339,7 @@ class TemplateTest < Minitest::Test
end
def test_raises_error_with_invalid_utf8
e = assert_raises(SyntaxError) do
e = assert_raises(TemplateEncodingError) do
Template.parse(<<~LIQUID)
{% comment %}
\xC0
@@ -347,6 +347,6 @@ class TemplateTest < Minitest::Test
LIQUID
end
assert_equal('Liquid syntax error: Invalid template encoding', e.message)
assert_equal('Liquid error: Invalid template encoding', e.message)
end
end