Better error handler
This commit is contained in:
parent
7526623ce0
commit
9a48ae3416
2 changed files with 14 additions and 8 deletions
11
index.js
11
index.js
|
|
@ -1,3 +1,4 @@
|
|||
import "./middleware/catchErrors.js";
|
||||
import { uvPath } from "@titaniumnetwork-dev/ultraviolet";
|
||||
import { epoxyPath } from "@mercuryworkshop/epoxy-transport";
|
||||
import { libcurlPath } from "@mercuryworkshop/libcurl-transport";
|
||||
|
|
@ -13,7 +14,6 @@ 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();
|
||||
|
||||
|
|
@ -21,7 +21,8 @@ const whiteListedDomains = ["aluu.xyz", "localhost"];
|
|||
const LICENSE_SERVER_URL = "https://license.mercurywork.shop/validate?license=";
|
||||
const MASQR_ENABLED = process.env.MASQR_ENABLED;
|
||||
|
||||
const log = (message) => console.log(chalk.gray("[Alu] " + message));
|
||||
const log = (message) => console.log(chalk.gray.bold("[Alu] " + message));
|
||||
const success = (message) => console.log(chalk.green.bold("[Alu] " + message));
|
||||
|
||||
const PORT = process.env.PORT;
|
||||
log("Starting Rammerhead...");
|
||||
|
|
@ -137,11 +138,11 @@ server.on("upgrade", (req, socket, head) => {
|
|||
});
|
||||
|
||||
log("Starting Alu...");
|
||||
console.log(chalk.green("[Alu] Alu started successfully!"));
|
||||
success("Alu started successfully!");
|
||||
server.on("listening", () => {
|
||||
console.log(chalk.green(`[Alu] Server running at http://localhost:${PORT}/.`));
|
||||
success(`Server running at http://localhost:${PORT}/.`);
|
||||
});
|
||||
|
||||
server.listen({
|
||||
port: PORT,
|
||||
});
|
||||
});
|
||||
|
|
@ -1,6 +1,11 @@
|
|||
import chalk from "chalk";
|
||||
|
||||
process.on("uncaughtException", (err) => {
|
||||
console.log(chalk.red("[Alu] Uncaught exception!", err));
|
||||
process.on('uncaughtException', (err) => {
|
||||
console.log(chalk.bold.red(`[Alu] Caught error!\n${err.stack}`));
|
||||
process.exit(1);
|
||||
});
|
||||
|
||||
process.on("uncaughtExceptionMonitor", (err) => {
|
||||
console.log(chalk.bold.red(`[Alu] Caught error!\n${err.stack}`));
|
||||
process.exit(1);
|
||||
});
|
||||
})
|
||||
Loading…
Add table
Reference in a new issue