CGI powered standard filters to handle non string inputs #898
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.
Problem
Some standard filters to not properly handle unexpected argument.
Solution
I'm usually aim to raise exceptions when the received parameters is not of the proper type(eg.:
Liquid::StandardError
), but most of the standard filters do explicitto_s
before processing the input (for the same reason we also do an explicit check fornil
?).I ended up adding explicit
to_s
.Thoughts?
Is this going in the right direction or should all non string parameters raise an exception?
Why is
nil
treated differently here compared to other filters? Seems to be a behaviour split introduced by 704937b#diff-844406140a08cdeddd843cfbdf0222d6L45