ventojs / vento

🌬 A template engine for Deno & Node
https://vento.js.org/
MIT License
212 stars 12 forks source link

Improve transform error handling with compiled function annotations #88

Open noelforte opened 2 days ago

noelforte commented 2 days ago

Here's an attempt to further improve #85. I'm not super happy with the implementation, since it feels like transform errors and template errors should be handled seperately. I didn't want to start refactoring everything so I tried to make these edits as reviewable as possible and keep the discussion going.

My reasoning for adding an annotated message logging the line of the compiled template function was to explain the errors that meriyah might throw and make it clear that the error is happening on a compiled function, not a user-authored one. To deal with these errors originating from the Eleventy integration, I also plan to add a message to my plugin reminding users to check for undeclared shortcodes and filters since those will cause errors when meriyah goes to parse/transform.

Happy to edit/revise further if there's a cleaner way of tracking these errors!


Also included in this pull: