diff --git a/index.js b/index.js index 6fb9b83..425c543 100644 --- a/index.js +++ b/index.js @@ -13,6 +13,7 @@ import wisp from "wisp-server-node"; import router from "./middleware/ProxyExt/index.js"; import { handler as astroSSR } from "./dist/server/entry.mjs"; import cookies from "cookie-parser"; +import "./middleware/catchErrors.js"; dotenv.config(); diff --git a/middleware/catchErrors.js b/middleware/catchErrors.js new file mode 100644 index 0000000..cbbb413 --- /dev/null +++ b/middleware/catchErrors.js @@ -0,0 +1,6 @@ +import chalk from "chalk"; + +process.on("uncaughtException", (err) => { + console.log(chalk.red("[Alu] Uncaught exception!", err)); + process.exit(1); +}); \ No newline at end of file