mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-28 22:55:12 -07:00
Merge pull request #662 from nickpearson/keep-argument-error-backtrace
Keep original stack trace in Liquid::ArgumentError
This commit is contained in:
@@ -52,7 +52,7 @@ module Liquid
|
|||||||
args.first
|
args.first
|
||||||
end
|
end
|
||||||
rescue ::ArgumentError => e
|
rescue ::ArgumentError => e
|
||||||
raise Liquid::ArgumentError.new(e.message)
|
raise Liquid::ArgumentError, e.message, e.backtrace
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -29,6 +29,18 @@ class StrainerUnitTest < Minitest::Test
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_stainer_argument_error_contains_backtrace
|
||||||
|
strainer = Strainer.create(nil)
|
||||||
|
begin
|
||||||
|
strainer.invoke("public_filter", 1)
|
||||||
|
rescue Liquid::ArgumentError => e
|
||||||
|
assert_match(
|
||||||
|
/\ALiquid error: wrong number of arguments \((1 for 0|given 1, expected 0)\)\z/,
|
||||||
|
e.message)
|
||||||
|
assert_equal e.backtrace[0].split(':')[0], __FILE__
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def test_strainer_only_invokes_public_filter_methods
|
def test_strainer_only_invokes_public_filter_methods
|
||||||
strainer = Strainer.create(nil)
|
strainer = Strainer.create(nil)
|
||||||
assert_equal false, strainer.class.invokable?('__test__')
|
assert_equal false, strainer.class.invokable?('__test__')
|
||||||
|
|||||||
Reference in New Issue
Block a user