I just woke up, it died last night, just gonna mke it crash when it does. Also log all errors for a file

This commit is contained in:
Christopher Cookman 2024-05-12 06:41:21 -06:00
parent 8b7f223493
commit 86b1717ba3
Signed by: ChrisChrome
GPG key ID: A023A26E42C33A42

View file

@ -1,4 +1,5 @@
// Requires // Requires
const fs = require("fs");
const config = require("./config.json"); const config = require("./config.json");
const wfos = require("./wfos.json"); const wfos = require("./wfos.json");
const iem = require("./iem.json"); const iem = require("./iem.json");
@ -1154,6 +1155,9 @@ discord.on("guildDelete", (guild) => {
process.on("unhandledRejection", (error) => { process.on("unhandledRejection", (error) => {
console.log(`${colors.red("[ERROR]")} Unhandled Rejection: ${error.stack}`); console.log(`${colors.red("[ERROR]")} Unhandled Rejection: ${error.stack}`);
// write ./error/rejection_timestamp.txt
fs.writeFileSync(`./error/rejection_${Date.now()}.txt`, error.stack);
process.exit(1);
if (false) { if (false) {
fetch(config.ntfy.server, { fetch(config.ntfy.server, {
method: 'POST', method: 'POST',
@ -1174,6 +1178,9 @@ process.on("unhandledRejection", (error) => {
process.on("uncaughtException", (error) => { process.on("uncaughtException", (error) => {
console.log(`${colors.red("[ERROR]")} Uncaught Exception: ${error.message}\n${error.stack}`); console.log(`${colors.red("[ERROR]")} Uncaught Exception: ${error.message}\n${error.stack}`);
// write ./error/exception_timestamp.txt
fs.writeFileSync(`./error/exception_${Date.now()}.txt`, error.stack);
process.exit(1);
if (false) { if (false) {
fetch(config.ntfy.server, { fetch(config.ntfy.server, {
method: 'POST', method: 'POST',