Test reporting of liquid error for filter call with wrong number of arguments#1311
Merged
Conversation
b6a63ac to
ab2d9ff
Compare
peterzhu2118
approved these changes
Oct 8, 2020
fbe86a8 to
ba90ba1
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Depends on the corresponding liquid-c fix (Shopify/liquid-c#76) for CI to passDepends on #1310 to fix CI on masterProblem
When trying to use Shopify/liquid-c#59 in Shopify Storefront, I noticed a CI failure that caught a problem with that PR. Specifically, that PR failed to implement the rescue in Liquid::StrainerTemplate#invoke
liquid/lib/liquid/strainer_template.rb
Lines 49 to 51 in bd34cd5
Solution
That rescue is at least needed right now to catch filter calls with the wrong number of arguments, so I added a test for that case. In the future, we may want to make sure filter methods explicitly do this translation for argument error exceptions, so it doesn't hide internal errors.
I added only a partial assertion for the error message, since the number of arguments it says were passed to the method and the number required includes the
inputargument, which could be confusing for a template author. For example, without the corresponding liquid-c test fix, the error message for| size: 'too many args'is "wrong number of arguments (given 2, expected 1)".