Error handling bugfix in dev server

This commit is contained in:
2026-07-20 20:41:30 +01:00
parent 1d0ac4aa80
commit e3a0f5fbeb
16 changed files with 582 additions and 431 deletions
+13 -2
View File
@@ -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}`);
}