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);