I am using Promises to chain various build steps together and calling preprocessFile with a callback inside the Promise constructor. When the code is run an exception is raised for the missing file and I cannot catch it with try...catch or Promise.catch(). This causes the entire script to halt.
As this build task is ran inside a file watcher (BrowserSync/chokidar) it halts the server, rather than giving me a chance to edit and save with automatic re-build. Here's a simplified version of the code, omitting the BrowserSync bit.
I could resort to fileNotFoundSilentFail: true and add a Promise.then() handler to check for the error message written into the output. It's not a big issue but a callback for this error would make for more natural code.
I have an HTML file with:
<!-- @extend non-existant-file.html -->
I am using Promises to chain various build steps together and calling
preprocessFile
with a callback inside the Promise constructor. When the code is run an exception is raised for the missing file and I cannot catch it withtry...catch
orPromise.catch()
. This causes the entire script to halt.As this build task is ran inside a file watcher (BrowserSync/chokidar) it halts the server, rather than giving me a chance to edit and save with automatic re-build. Here's a simplified version of the code, omitting the BrowserSync bit.
I could resort to
fileNotFoundSilentFail: true
and add aPromise.then()
handler to check for the error message written into the output. It's not a big issue but a callback for this error would make for more natural code.