Create folder for errors

This commit is contained in:
Christopher Cookman 2024-05-12 10:47:14 -06:00
parent 5cadf7a8d0
commit ec7ed2c16a
Signed by: ChrisChrome
GPG key ID: A023A26E42C33A42

View file

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