aboutsummaryrefslogtreecommitdiff
path: root/src/listeners/other
diff options
context:
space:
mode:
authorIRONM00N <64110067+IRONM00N@users.noreply.github.com>2022-06-02 18:10:17 -0400
committerIRONM00N <64110067+IRONM00N@users.noreply.github.com>2022-06-02 18:10:17 -0400
commit5f4f28903b2f3428e54ed74417fc06e8eeb58ebf (patch)
tree6c31807fa3de0bb142ae2bfc7496ee96663a81eb /src/listeners/other
parent34b55d206c5048b4abacf68c663261f494c888a2 (diff)
downloadtanzanite-5f4f28903b2f3428e54ed74417fc06e8eeb58ebf.tar.gz
tanzanite-5f4f28903b2f3428e54ed74417fc06e8eeb58ebf.tar.bz2
tanzanite-5f4f28903b2f3428e54ed74417fc06e8eeb58ebf.zip
feat(errorHandler): ansi colors
Diffstat (limited to 'src/listeners/other')
-rw-r--r--src/listeners/other/promiseRejection.ts8
-rw-r--r--src/listeners/other/uncaughtException.ts4
-rw-r--r--src/listeners/other/warning.ts14
3 files changed, 14 insertions, 12 deletions
diff --git a/src/listeners/other/promiseRejection.ts b/src/listeners/other/promiseRejection.ts
index 270db46..1157556 100644
--- a/src/listeners/other/promiseRejection.ts
+++ b/src/listeners/other/promiseRejection.ts
@@ -21,10 +21,14 @@ export default class PromiseRejectionListener extends BushListener {
level: Severity.Error
});
- void client.console.error('promiseRejection', `An unhanded promise rejection occurred:\n${util.formatError(error)}`, false);
+ void client.console.error(
+ 'promiseRejection',
+ `An unhanded promise rejection occurred:\n${util.formatError(error, true)}`,
+ false
+ );
if (!error.message.includes('reason: getaddrinfo ENOTFOUND canary.discord.com'))
void client.console.channelError({
- embeds: [await CommandErrorListener.generateErrorEmbed({ type: 'unhandledRejection', error: error })]
+ embeds: await CommandErrorListener.generateErrorEmbed({ type: 'unhandledRejection', error: error })
});
}
}
diff --git a/src/listeners/other/uncaughtException.ts b/src/listeners/other/uncaughtException.ts
index b12f76d..4a66515 100644
--- a/src/listeners/other/uncaughtException.ts
+++ b/src/listeners/other/uncaughtException.ts
@@ -20,9 +20,9 @@ export default class UncaughtExceptionListener extends BushListener {
level: Severity.Error
});
- void client.console.error('uncaughtException', `An uncaught exception occurred:\n${util.formatError(error)}`, false);
+ void client.console.error('uncaughtException', `An uncaught exception occurred:\n${util.formatError(error, true)}`, false);
void client.console.channelError({
- embeds: [await CommandErrorListener.generateErrorEmbed({ type: 'uncaughtException', error: error })]
+ embeds: await CommandErrorListener.generateErrorEmbed({ type: 'uncaughtException', error: error })
});
}
}
diff --git a/src/listeners/other/warning.ts b/src/listeners/other/warning.ts
index 2412221..8e1fdf6 100644
--- a/src/listeners/other/warning.ts
+++ b/src/listeners/other/warning.ts
@@ -17,13 +17,11 @@ export default class WarningListener extends BushListener {
level: Severity.Warning
});
- 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 }))
- .setColor(util.colors.warn)
- .setTitle('A Warning Occurred')
- ]
- });
+ void client.console.warn('warning', `A warning occurred:\n${util.formatError(error, true)}`, false);
+
+ const embeds = await CommandErrorListener.generateErrorEmbed({ type: 'unhandledRejection', error: error });
+ embeds[0].setColor(util.colors.warn).setTitle('A Warning Occurred');
+
+ void client.console.channelError({ embeds });
}
}