Error handling bugfix in dev server
This commit is contained in:
Vendored
+13
-2
@@ -4,11 +4,22 @@ import bunextInit from "../../functions/bunext-init";
|
||||
import grabDirNames from "../../utils/grab-dir-names";
|
||||
import { rmSync } from "fs";
|
||||
const { HYDRATION_DST_DIR, BUNX_CWD_PAGES_REWRITE_DIR } = grabDirNames();
|
||||
process.on("uncaughtException", (error) => {
|
||||
log.error(`Uncaught exception: ${error}`);
|
||||
});
|
||||
process.on("unhandledRejection", (reason) => {
|
||||
log.error(`Unhandled rejection: ${reason}`);
|
||||
});
|
||||
log.info("Running development server ...");
|
||||
try {
|
||||
rmSync(HYDRATION_DST_DIR, { recursive: true });
|
||||
rmSync(BUNX_CWD_PAGES_REWRITE_DIR, { recursive: true });
|
||||
}
|
||||
catch (error) { }
|
||||
await bunextInit();
|
||||
await startServer();
|
||||
try {
|
||||
await bunextInit();
|
||||
await startServer();
|
||||
}
|
||||
catch (error) {
|
||||
log.error(`Failed to start development server: ${error}`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user