From ec7ed2c16ad588cc6c4fc692ef2333bef287df56 Mon Sep 17 00:00:00 2001 From: ChrisChrome Date: Sun, 12 May 2024 10:47:14 -0600 Subject: [PATCH] Create folder for errors --- index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/index.js b/index.js index def6b42..68d96e1 100644 --- a/index.js +++ b/index.js @@ -1194,6 +1194,9 @@ process.on("unhandledRejection", (error, promise) => { process.on("uncaughtException", (error) => { console.log(`${colors.red("[ERROR]")} Uncaught Exception: ${error.message}\n${error.stack}`); + if (!fs.existsSync("./error")) { + fs.mkdirSync("./error"); + } // write ./error/exception_timestamp.txt fs.writeFileSync(`./error/exception_${Date.now()}.txt`, error.stack); process.exit(1);