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 { uvPath } from "@titaniumnetwork-dev/ultraviolet";
|
||||||
import { epoxyPath } from "@mercuryworkshop/epoxy-transport";
|
import { epoxyPath } from "@mercuryworkshop/epoxy-transport";
|
||||||
import { libcurlPath } from "@mercuryworkshop/libcurl-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 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();
|
||||||
|
|
||||||
|
|
@ -21,7 +21,8 @@ const whiteListedDomains = ["aluu.xyz", "localhost"];
|
||||||
const LICENSE_SERVER_URL = "https://license.mercurywork.shop/validate?license=";
|
const LICENSE_SERVER_URL = "https://license.mercurywork.shop/validate?license=";
|
||||||
const MASQR_ENABLED = process.env.MASQR_ENABLED;
|
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;
|
const PORT = process.env.PORT;
|
||||||
log("Starting Rammerhead...");
|
log("Starting Rammerhead...");
|
||||||
|
|
@ -137,11 +138,11 @@ server.on("upgrade", (req, socket, head) => {
|
||||||
});
|
});
|
||||||
|
|
||||||
log("Starting Alu...");
|
log("Starting Alu...");
|
||||||
console.log(chalk.green("[Alu] Alu started successfully!"));
|
success("Alu started successfully!");
|
||||||
server.on("listening", () => {
|
server.on("listening", () => {
|
||||||
console.log(chalk.green(`[Alu] Server running at http://localhost:${PORT}/.`));
|
success(`Server running at http://localhost:${PORT}/.`);
|
||||||
});
|
});
|
||||||
|
|
||||||
server.listen({
|
server.listen({
|
||||||
port: PORT,
|
port: PORT,
|
||||||
});
|
});
|
||||||
|
|
@ -1,6 +1,11 @@
|
||||||
import chalk from "chalk";
|
import chalk from "chalk";
|
||||||
|
|
||||||
process.on("uncaughtException", (err) => {
|
process.on('uncaughtException', (err) => {
|
||||||
console.log(chalk.red("[Alu] Uncaught exception!", 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);
|
process.exit(1);
|
||||||
});
|
})
|
||||||
Loading…
Add table
Reference in a new issue