blinkk / amagaki

A high-performance TypeScript static website generator for building highly-interactive websites. Localization inbuilt. Flexible URLs. Content managed and templates separated.
https://amagaki.dev
MIT License
36 stars 2 forks source link

fix: Fix issue with uncaught exceptions from timers. #215

Closed Zoramite closed 1 year ago

Zoramite commented 1 year ago

The timer execution was adding a promise .then handler but not handling exceptions.

This caused the error to be added to processes' unhandled exceptions even when the promise.all was also catching the error.

This change wraps the timer stopping and the triggering of the plugin hook into an async function. The Promise.all can correctly correlate the hooks while still getting accurate time execution.

stevenle commented 1 year ago

(removing myself from review, i have 7 launches in the next 2 weeks and am not familiar with amagaki's codebase enough to provide quality guidance here.)

jeremydw commented 1 year ago

@Zoramite I forget how this was originally set up and used (IIRC you may have been the original author!) so I won't be able to provide too much deep thought either here but if it works for you it works for me, so LGTM.