Add error catcher to Alu's server
This commit is contained in:
parent
859d84969f
commit
7526623ce0
2 changed files with 7 additions and 0 deletions
1
index.js
1
index.js
|
|
@ -13,6 +13,7 @@ import wisp from "wisp-server-node";
|
||||||
import router from "./middleware/ProxyExt/index.js";
|
import router from "./middleware/ProxyExt/index.js";
|
||||||
import { handler as astroSSR } from "./dist/server/entry.mjs";
|
import { handler as astroSSR } from "./dist/server/entry.mjs";
|
||||||
import cookies from "cookie-parser";
|
import cookies from "cookie-parser";
|
||||||
|
import "./middleware/catchErrors.js";
|
||||||
|
|
||||||
dotenv.config();
|
dotenv.config();
|
||||||
|
|
||||||
|
|
|
||||||
6
middleware/catchErrors.js
Normal file
6
middleware/catchErrors.js
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
import chalk from "chalk";
|
||||||
|
|
||||||
|
process.on("uncaughtException", (err) => {
|
||||||
|
console.log(chalk.red("[Alu] Uncaught exception!", err));
|
||||||
|
process.exit(1);
|
||||||
|
});
|
||||||
Loading…
Add table
Reference in a new issue