You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
I found out today that eleventy.after only runs after successful builds; if an error occurs, it doesn't run. This is problematic for customizations that need to perform cleanup whether the build succeeds or not.
Describe the solution you'd like
I presume we wouldn't want to alter the existing behavior of eleventy.after. Can we add an eleventy.afterError or something?
Describe alternatives you've considered
I'm not aware if there's any other way of handling error cases from withineleventy.config.js. Writing a wrapper around the entire build invocation is problematic, especially if it needs access to variables set up inside the config function.
Additional context
No response
The text was updated successfully, but these errors were encountered:
I feel like a JavaScript~y way would be eleventy.onerror. An eleventy.finally could also be useful in case of cleaning up (file handler, database connections or what-have-you)
If it were named eleventy.finally I'd expect it to fire both on success and failure, which would be fine for my current case, but I wonder if folks might have use cases specifically for failure as well.
eleventy.error could be fine for that, but I would vote against eleventy.onerror specifically as that would cause redundant "on" (eleventyConfig.on("eleventy.onerror")) which is not the way DOM APIs work (e.g. addEventListener("click") not addEventListener("onclick")).
I was thinking on an eleventyConfig.onerror(callback) but haven't used its Event callbacks before (yet).
From my jQuery days event namespaces already used dots (although I have also seen a convention using colons).
Is your feature request related to a problem? Please describe.
I found out today that
eleventy.after
only runs after successful builds; if an error occurs, it doesn't run. This is problematic for customizations that need to perform cleanup whether the build succeeds or not.Describe the solution you'd like
I presume we wouldn't want to alter the existing behavior of
eleventy.after
. Can we add aneleventy.afterError
or something?Describe alternatives you've considered
I'm not aware if there's any other way of handling error cases from within
eleventy.config.js
. Writing a wrapper around the entire build invocation is problematic, especially if it needs access to variables set up inside the config function.Additional context
No response
The text was updated successfully, but these errors were encountered: