Fullstack errors

This commit is contained in:
Christopher Cookman 2024-08-11 21:59:23 -06:00
parent 9e3e03836b
commit 6a5fbf3790
Signed by: ChrisChrome
GPG key ID: A023A26E42C33A42

View file

@ -1664,11 +1664,11 @@ dcClient.on('interactionCreate', async interaction => {
// Lets actually handle exceptions now // Lets actually handle exceptions now
process.on('unhandledRejection', (error) => { process.on('unhandledRejection', (error) => {
// Log a full error with line number // Log a full error with line number
sendLog(`${colors.red("[ERROR]")} ${error}`); sendLog(`${colors.red("[ERROR]")} ${error.stack}`);
// If config.ntfyUrl is set, Send the exception to ntfy // If config.ntfyUrl is set, Send the exception to ntfy
if (config.ntfyUrl) fetch(config.ntfyUrl, { if (config.ntfyUrl) fetch(config.ntfyUrl, {
method: 'POST', // PUT works too method: 'POST', // PUT works too
body: error, body: error.stack,
headers: { headers: {
'Title': 'FreePBX Bot Rejection', 'Title': 'FreePBX Bot Rejection',
'Priority': 5, 'Priority': 5,
@ -1679,11 +1679,11 @@ process.on('unhandledRejection', (error) => {
process.on('uncaughtException', (error) => { process.on('uncaughtException', (error) => {
// Log a full error with line number // Log a full error with line number
sendLog(`${colors.red("[ERROR]")} ${error}`); sendLog(`${colors.red("[ERROR]")} ${error.stack}`);
// If config.ntfyUrl is set, Send the exception to ntfy // If config.ntfyUrl is set, Send the exception to ntfy
if (config.ntfyUrl) fetch(config.ntfyUrl, { if (config.ntfyUrl) fetch(config.ntfyUrl, {
method: 'POST', // PUT works too method: 'POST', // PUT works too
body: error, body: error.stack,
headers: { headers: {
'Title': 'FreePBX Bot Exception', 'Title': 'FreePBX Bot Exception',
'Priority': 5, 'Priority': 5,