Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better Liquid tag error handling #1511

Closed
maestromac opened this issue Jan 10, 2019 · 4 comments
Closed

Better Liquid tag error handling #1511

maestromac opened this issue Jan 10, 2019 · 4 comments
Labels
area: publishing experience issues related to an authors experience publishing. Tags, series, etc. tech: ruby changes will heavily involve both Ruby code

Comments

@maestromac
Copy link
Member

maestromac commented Jan 10, 2019

Is your feature request related to a problem? Please describe.
Whenever there's an error in the liquid tag, the editor should try it's best to inform the author what went wrong and not display the dreaded Liquid error: internal. This has also proven to be difficult to debug in development.

Describe the solution you'd like
Currently, we are making our individual custom liquid tag to raise StandardError upon initialization if there's an... ArgumentError. We are doing this because any form of error that happens within #render will throw a Liquid error: internal.

A better solution would be to let Liquid parse normally, ie Liquid::Template.parse(sanitized_content), then check for errors with Liquid.errors. This also has the added benefit of catching multiple errors at once, letting them be added to errors to be displayed in the view.

Describe alternatives you've considered
There could be a better solution I've missed in this documentation.

Additional context
This should also account both of our editor versions.

@rhymes
Copy link
Contributor

rhymes commented May 19, 2020

This contains useful information as well #7898

@marcospedro97
Copy link

This issue is available? Can I give it a try?

@maestromac
Copy link
Member Author

Yes @marcospedro97 . Please give it a try!

@marcospedro97
Copy link

marcospedro97 commented Oct 11, 2020

While working in the issue I've manged to catch more errors than we have currently, the main problem I've seen on issue #7898 is that even with the problem the post was created, using the parsed_liquid.errors in the markdown parser this wouldn't happen again, but this didn't allow me to show more than a single error in the view (at least without changing the view code, or maybe the code of the liquid, I didn't check who's the one that give this behavior), I've also started asking myself if giving the line were the error occurred wouldn't be a improvement since debugging that post was clearly a problem, if anyone has a thought to share about this, I would be glad to read

@cmgorton cmgorton added the tech: ruby changes will heavily involve both Ruby code label Jan 14, 2021
@cmgorton cmgorton removed the external contributors welcome contribution is welcome! label Feb 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: publishing experience issues related to an authors experience publishing. Tags, series, etc. tech: ruby changes will heavily involve both Ruby code
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants