const axios = require("axios"); var whURL = process.env.consolewh; axios.post(whURL, { embeds: [ { title: "INFO", description: "`🟢` Error Handler Started", timestamp: new Date().toISOString(), } ] }); //unhandledRejection process.on('unhandledRejection', async(reason, promise) => { console.error( "[ANTI-CRASH] An error has occured and been successfully handled: [unhandledRejection]") console.log(reason, promise); axios.post(whURL, { embeds: [{ title: "Error Handler 🚨", color: 0xf20000, description: `\`\`\`js\n${(reason.stack).substring(0, 4000).replace(/home\/user\/app/g, "@local/me/host/*")}\`\`\``, timestamp: new Date().toISOString(), footer: { text: "[unhandledRejection]", }, }] }).catch(); }); process.on("uncaughtException", async(err, origin) => { console.error(`[ANTI-CRASH] An error has occured and been successfully handled: [uncaughtException]`) console.log(err, origin) let errEmbed = { title: "Error Handler 🚨", color: 0xf20000, description: `\`\`\`js\n${(err.stack).substring(0, 4000).replace(/home\/user\/app/g, "@local/me/host/*")}\`\`\``, timestamp: new Date().toISOString(), footer: { text: "[uncaughtException]", }, } axios.post(whURL, { embeds: [errEmbed] }).catch(); }); process.on('uncaughtExceptionMonitor', async(err, origin) => { console.error("[ANTI-CRASH] An error has occured and been successfully handled: [uncaughtExceptionMonitor]"); console.log(err, origin) let errEmbed = { title: "Error Handler 🚨", color: 0xf20000, description: `\`\`\`js\n${(err.stack).substring(0, 4000).replace(/home\/user\/app/g, "@local/me/host/*")}\`\`\``, timestamp: new Date().toISOString(), footer: { text: "[uncaughtExceptionMonitor]", }, } axios.post(whURL, { embeds: [errEmbed] }).catch(); }); process.on('rejectionHandled', async(reason, promise) => { console.error( "[ANTI-CRASH] An error has occured and been successfully handled: [rejectionHandled]") console.log(reason, promise); axios.post(whURL, { embeds: [{ title: "Error Handler 🚨", color: 0xf20000, description: `\`\`\`js\n${(reason.stack).substring(0, 4000).replace(/home\/user\/app/g, "@local/me/host/*")}\`\`\``, timestamp: new Date().toISOString(), footer: { text: "[rejectionHandled]", }, }] }).catch(); }); process.on('warning', async(reason, promise) => { console.error( "[ANTI-CRASH] An error has occured and been successfully handled: [warning]") console.log(reason, promise); axios.post(whURL, { embeds: [{ title: "Error Handler 🚨", color: 0xff8800, description: `\`\`\`js\n${(reason.stack).substring(0, 4000).replace(/home\/user\/app/g, "@local/me/host/*")}\`\`\``, timestamp: new Date().toISOString(), footer: { text: "[warning]", }, }] }).catch(); });