diff options
Diffstat (limited to 'src/listeners/other')
-rw-r--r-- | src/listeners/other/promiseRejection.ts | 10 | ||||
-rw-r--r-- | src/listeners/other/uncaughtException.ts | 10 |
2 files changed, 4 insertions, 16 deletions
diff --git a/src/listeners/other/promiseRejection.ts b/src/listeners/other/promiseRejection.ts index 24493f7..ea6f9d1 100644 --- a/src/listeners/other/promiseRejection.ts +++ b/src/listeners/other/promiseRejection.ts @@ -1,4 +1,5 @@ import { BushListener } from '@lib'; +import CommandErrorListener from '../commands/commandError'; export default class PromiseRejectionListener extends BushListener { public constructor() { @@ -12,14 +13,7 @@ export default class PromiseRejectionListener extends BushListener { // eslint-disable-next-line @typescript-eslint/no-base-to-string void client.console.error('PromiseRejection', `An unhanded promise rejection occurred:\n${error?.stack ?? error}`, false); void client.console.channelError({ - embeds: [ - { - title: 'Unhandled promise rejection', - // eslint-disable-next-line @typescript-eslint/no-base-to-string - fields: [{ name: 'error', value: await util.codeblock(`${error?.stack ?? error}`, 1024, 'js') }], - color: util.colors.error - } - ] + embeds: [await CommandErrorListener.generateErrorEmbed({ type: 'unhandledRejection', error: error })] }); } } diff --git a/src/listeners/other/uncaughtException.ts b/src/listeners/other/uncaughtException.ts index 5f4bd46..47db37f 100644 --- a/src/listeners/other/uncaughtException.ts +++ b/src/listeners/other/uncaughtException.ts @@ -1,4 +1,5 @@ import { BushListener } from '@lib'; +import CommandErrorListener from '../commands/commandError'; export default class UncaughtExceptionListener extends BushListener { public constructor() { @@ -12,14 +13,7 @@ export default class UncaughtExceptionListener extends BushListener { // eslint-disable-next-line @typescript-eslint/no-base-to-string void client.console.error('uncaughtException', `An uncaught exception occurred:\n${error?.stack ?? error}`, false); void client.console.channelError({ - embeds: [ - { - title: 'An uncaught exception occurred', - // eslint-disable-next-line @typescript-eslint/no-base-to-string - fields: [{ name: 'error', value: await util.codeblock(`${error?.stack ?? error}`, 1024, 'js') }], - color: util.colors.error - } - ] + embeds: [await CommandErrorListener.generateErrorEmbed({ type: 'uncaughtException', error: error })] }); } } |