Gonna try not killing the bot on rejection/exception, see what happens
This commit is contained in:
parent
ec7ed2c16a
commit
bcdda75a77
36
index.js
36
index.js
|
@ -1172,23 +1172,7 @@ process.on("unhandledRejection", (error, promise) => {
|
||||||
}
|
}
|
||||||
// write ./error/rejection_timestamp.txt
|
// write ./error/rejection_timestamp.txt
|
||||||
fs.writeFileSync(`./error/rejection_${Date.now()}.txt`, `ERROR:\n${error}\n\nPROMISE:\n${promise}`);
|
fs.writeFileSync(`./error/rejection_${Date.now()}.txt`, `ERROR:\n${error}\n\nPROMISE:\n${promise}`);
|
||||||
process.exit(1);
|
return;
|
||||||
if (false) {
|
|
||||||
fetch(config.ntfy.server, {
|
|
||||||
method: 'POST',
|
|
||||||
body: JSON.stringify({
|
|
||||||
"topic": config.ntfy.errors,
|
|
||||||
"message": `Unhandled Rejection: ${error.message}`,
|
|
||||||
"tags": ["Error"],
|
|
||||||
"priority": 5
|
|
||||||
}),
|
|
||||||
headers: {
|
|
||||||
'Authorization': `Bearer ${config.ntfy.token}`
|
|
||||||
}
|
|
||||||
}).catch((err) => {
|
|
||||||
console.error(err)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
process.on("uncaughtException", (error) => {
|
process.on("uncaughtException", (error) => {
|
||||||
|
@ -1199,23 +1183,7 @@ process.on("uncaughtException", (error) => {
|
||||||
}
|
}
|
||||||
// write ./error/exception_timestamp.txt
|
// write ./error/exception_timestamp.txt
|
||||||
fs.writeFileSync(`./error/exception_${Date.now()}.txt`, error.stack);
|
fs.writeFileSync(`./error/exception_${Date.now()}.txt`, error.stack);
|
||||||
process.exit(1);
|
return;
|
||||||
if (false) {
|
|
||||||
fetch(config.ntfy.server, {
|
|
||||||
method: 'POST',
|
|
||||||
body: JSON.stringify({
|
|
||||||
"topic": config.ntfy.errors,
|
|
||||||
"message": `Uncaught Exception: ${error.message}\n${error.stack}`,
|
|
||||||
"tags": ["Error"],
|
|
||||||
"priority": 5
|
|
||||||
}),
|
|
||||||
headers: {
|
|
||||||
'Authorization': `Bearer ${config.ntfy.token}`
|
|
||||||
}
|
|
||||||
}).catch((err) => {
|
|
||||||
console.error(err)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Login to discord
|
// Login to discord
|
||||||
|
|
Loading…
Reference in a new issue