From 4eb9563b4c3742b2f2857db2fa0471616903a27e Mon Sep 17 00:00:00 2001 From: adh319 Date: Sun, 22 Sep 2024 21:13:04 +0800 Subject: [PATCH] Create anticrash.js --- src/handlers/anticrash.js | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 src/handlers/anticrash.js diff --git a/src/handlers/anticrash.js b/src/handlers/anticrash.js new file mode 100644 index 0000000..f685fbc --- /dev/null +++ b/src/handlers/anticrash.js @@ -0,0 +1,30 @@ +module.exports = async () => { + process.on("unhandledRejection", async (reason, promise) => { + console.error("[Anticrash] | [UnhandledRejection_Logs] | [start] : ==============="); + console.error("Unhandled Rejection at:", promise, "reason:", reason); + console.error("[Anticrash] | [UnhandledRejection_Logs] | [end] : ==============="); + }); + + process.on("uncaughtException", async (err, origin) => { + console.error("[Anticrash] | [UncaughtException_Logs] | [Start] : ==============="); + console.error(`Uncaught exception: ${err}\n` + `Exception origin: ${origin}`); + console.error("[Anticrash] | [UncaughtException_Logs] | [End] : ==============="); + }); + + process.on("uncaughtExceptionMonitor", async (err, origin) => { + console.error("[Anticrash] | [UncaughtExceptionMonitor_Logs] | [Start] : ==============="); + console.error(`Uncaught exception monitor: ${err}\n` + `Exception origin: ${origin}`); + console.error("[Anticrash] | [UncaughtExceptionMonitor_Logs] | [End] : ==============="); + }); + + console.log("[INFO] Anticrash events loaded"); +}; + +/** + * Project: Lunox + * Author: adh319 + * Company: EnourDev + * This code is the property of EnourDev and may not be reproduced or + * modified without permission. For more information, contact us at + * https://discord.gg/xhTVzbS5NU + */