Fix handling unexpected errors during build

This commit is contained in:
zodern
2023-06-13 11:50:24 -05:00
parent a67cf288a3
commit 3b48d73b7e
2 changed files with 16 additions and 15 deletions

View File

@@ -3295,17 +3295,13 @@ async function bundle({
buildMode: buildOptions.buildMode
});
try {
await client.make({
packages: [app],
minifyMode: minifyMode,
minifiers: options.minifiers || [],
addCacheBusters: true,
onJsOutputFiles,
});
} catch (e) {
// it's fine to fail here, but we don't want to propagate the error
}
await client.make({
packages: [app],
minifyMode: minifyMode,
minifiers: options.minifiers || [],
addCacheBusters: true,
onJsOutputFiles,
});
return client;
});

View File

@@ -405,7 +405,15 @@ Object.assign(AppRunner.prototype, {
self.isRunning = true;
global.asyncLocalStorage.run({}, () =>
self._runApp().catch((e) => self._resolvePromise("start", e))
self._runApp()
.catch((e) => {
// There was an unexpected error when building the app
// This is not recoverable, so we turn it into an unhandled exception
// and crash.
setTimeout(() => {
throw e;
});
})
);
await self.startPromise;
self.startPromise = null;
@@ -435,9 +443,6 @@ Object.assign(AppRunner.prototype, {
ee.emit(name, value);
this._promiseResolvers[name] = null;
}
if (value instanceof Error) {
throw value;
}
},
_cleanUpPromises: function () {