diff options
author | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2022-05-27 22:39:07 -0400 |
---|---|---|
committer | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2022-05-27 22:39:07 -0400 |
commit | 94c20f17f1a87e594fc07a75eb6026891086c67c (patch) | |
tree | f32942ce07630352afbf4d7be2b718fc9724502c /src/listeners | |
parent | f718df9321f2ff28a5a1f20d53e474fbf5998d6e (diff) | |
download | tanzanite-94c20f17f1a87e594fc07a75eb6026891086c67c.tar.gz tanzanite-94c20f17f1a87e594fc07a75eb6026891086c67c.tar.bz2 tanzanite-94c20f17f1a87e594fc07a75eb6026891086c67c.zip |
fix: use util#formatError
Diffstat (limited to 'src/listeners')
-rw-r--r-- | src/listeners/commands/commandError.ts | 4 | ||||
-rw-r--r-- | src/listeners/contextCommands/contextCommandError.ts | 2 | ||||
-rw-r--r-- | src/listeners/other/promiseRejection.ts | 6 | ||||
-rw-r--r-- | src/listeners/other/uncaughtException.ts | 6 | ||||
-rw-r--r-- | src/listeners/other/warning.ts | 2 |
5 files changed, 6 insertions, 14 deletions
diff --git a/src/listeners/commands/commandError.ts b/src/listeners/commands/commandError.ts index d590e06..895cff0 100644 --- a/src/listeners/commands/commandError.ts +++ b/src/listeners/commands/commandError.ts @@ -46,7 +46,7 @@ export default class CommandErrorListener extends BushListener { `${isSlash ? 'slashC' : 'c'}ommandError`, `an error occurred with the <<${command}>> ${isSlash ? 'slash ' : ''}command in <<${channel}>> triggered by <<${ message?.author?.tag - }>>:\n${error?.stack ?? <any>error}`, + }>>:\n${util.formatError(error)})}`, false ); @@ -229,7 +229,7 @@ export default class CommandErrorListener extends BushListener { } public static async getErrorStack(error: Error | any): Promise<string> { - return await util.inspectCleanRedactCodeblock(error?.stack ?? error, 'js'); + return await util.inspectCleanRedactCodeblock(util.formatError(error), 'js'); } } diff --git a/src/listeners/contextCommands/contextCommandError.ts b/src/listeners/contextCommands/contextCommandError.ts index 04a97ad..86cbac8 100644 --- a/src/listeners/contextCommands/contextCommandError.ts +++ b/src/listeners/contextCommands/contextCommandError.ts @@ -44,7 +44,7 @@ export default class ContextCommandErrorListener extends BushListener { `contextCommandError`, `an error occurred with the <<${command}>> context command in <<${channel}>> triggered by <<${ interaction?.user?.tag - }>>:\n${error?.stack ?? <any>error}`, + }>>:\n${util.formatError(error)}`, false ); diff --git a/src/listeners/other/promiseRejection.ts b/src/listeners/other/promiseRejection.ts index 69a62c7..270db46 100644 --- a/src/listeners/other/promiseRejection.ts +++ b/src/listeners/other/promiseRejection.ts @@ -21,11 +21,7 @@ export default class PromiseRejectionListener extends BushListener { level: Severity.Error }); - void client.console.error( - 'promiseRejection', - `An unhanded promise rejection occurred:\n${typeof error == 'object' ? error.stack : error}`, - false - ); + void client.console.error('promiseRejection', `An unhanded promise rejection occurred:\n${util.formatError(error)}`, false); if (!error.message.includes('reason: getaddrinfo ENOTFOUND canary.discord.com')) void client.console.channelError({ embeds: [await CommandErrorListener.generateErrorEmbed({ type: 'unhandledRejection', error: error })] diff --git a/src/listeners/other/uncaughtException.ts b/src/listeners/other/uncaughtException.ts index b650620..b12f76d 100644 --- a/src/listeners/other/uncaughtException.ts +++ b/src/listeners/other/uncaughtException.ts @@ -20,11 +20,7 @@ export default class UncaughtExceptionListener extends BushListener { level: Severity.Error }); - void client.console.error( - 'uncaughtException', - `An uncaught exception occurred:\n${typeof error == 'object' ? error.stack : error}`, - false - ); + void client.console.error('uncaughtException', `An uncaught exception occurred:\n${util.formatError(error)}`, false); void client.console.channelError({ embeds: [await CommandErrorListener.generateErrorEmbed({ type: 'uncaughtException', error: error })] }); diff --git a/src/listeners/other/warning.ts b/src/listeners/other/warning.ts index 57f2a7d..2412221 100644 --- a/src/listeners/other/warning.ts +++ b/src/listeners/other/warning.ts @@ -17,7 +17,7 @@ export default class WarningListener extends BushListener { level: Severity.Warning }); - void client.console.warn('warning', `A warning occurred:\n${typeof error == 'object' ? error.stack : error}`, false); + void client.console.warn('warning', `A warning occurred:\n${util.formatError(error)}`, false); void client.console.channelError({ embeds: [ (await CommandErrorListener.generateErrorEmbed({ type: 'unhandledRejection', error: error })) |