Create folder for errors
This commit is contained in:
parent
5cadf7a8d0
commit
ec7ed2c16a
3
index.js
3
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);
|
||||
|
|
Loading…
Reference in a new issue