Open rjhankison opened 5 years ago
Here's a bit of a better example:
If I format the string like this {{deal.invoice_created_at | date: "%d.%m.%y}}
, it throws an error like this.. I'd love to catch these types of errors if possible.
Thanks!
That's interesting find. I'll see what I can do but I don't think it'll happen this week. If you in a hurry, consider contributing to the project. I'm sure I'll find the time to review a PR.
Cool! I'll try to work that in this week. Any pointers on where to get started?
First I'd added a test for the type of Liquid\Exception
you think this should be. (ParseException
seems like the best fit.) Just for the time being you can add it to the StandardFiltersTest
.
Next I'd be looking around these lines:
This appears to be where filter arguments are parsed out, but I may be wrong assuming the very this place needs some work.
Hi again,
Thanks very much for the help with the white space control. Our team really appreciates it. This package has been a huge hit for our customers.
Another question -- we're using a custom validation rule in our controllers to try to catch errors our customers may have added. Here's what we have:
However, this doesn't seem to catch errors like poorly formatted date filters. For example,
{{deal.invoice_created_at | date: %d.%m.%y}}
passes, even though it's missing the quotes in the second parameter. Is there a way to catch these errors? This is less of an issue now because it's no longer throwing an exception on view if the filter is malformatted, but it'd be great if I could create a validation rule to catch those errors upfront.Thanks again! Really appreciate your attentions. :)
Best, -Rich