Fullstack errors
This commit is contained in:
parent
9e3e03836b
commit
6a5fbf3790
8
index.js
8
index.js
|
@ -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,
|
||||||
|
|
Loading…
Reference in a new issue