aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lib/utils/BushLogger.ts2
-rw-r--r--src/listeners/other/promiseRejection.ts7
-rw-r--r--src/listeners/other/uncaughtException.ts7
-rw-r--r--src/listeners/other/warning.ts22
4 files changed, 33 insertions, 5 deletions
diff --git a/src/lib/utils/BushLogger.ts b/src/lib/utils/BushLogger.ts
index c2a9989..f00c19c 100644
--- a/src/lib/utils/BushLogger.ts
+++ b/src/lib/utils/BushLogger.ts
@@ -156,7 +156,7 @@ export class BushLogger {
.setDescription(`**[${header}]** ${this.#parseFormatting(this.#stripColor(newContent), '', true)}`)
.setColor(util.colors.warn)
.setTimestamp();
- await this.channelLog({ embeds: [embed] });
+ await this.channelError({ embeds: [embed] });
}
/**
diff --git a/src/listeners/other/promiseRejection.ts b/src/listeners/other/promiseRejection.ts
index 130daa3..dc21c3f 100644
--- a/src/listeners/other/promiseRejection.ts
+++ b/src/listeners/other/promiseRejection.ts
@@ -10,8 +10,11 @@ export default class PromiseRejectionListener extends BushListener {
}
public override async exec(error: Error): Promise<void> {
- // 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.error(
+ 'promiseRejection',
+ `An unhanded promise rejection occurred:\n${typeof error == 'object' ? error.stack : 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 47db37f..4ba47bd 100644
--- a/src/listeners/other/uncaughtException.ts
+++ b/src/listeners/other/uncaughtException.ts
@@ -10,8 +10,11 @@ export default class UncaughtExceptionListener extends BushListener {
}
public override async exec(error: Error): Promise<void> {
- // 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.error(
+ 'uncaughtException',
+ `An uncaught exception occurred:\n${typeof error == 'object' ? error.stack : 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
new file mode 100644
index 0000000..d85e9e3
--- /dev/null
+++ b/src/listeners/other/warning.ts
@@ -0,0 +1,22 @@
+import { BushListener } from '@lib';
+import CommandErrorListener from '../commands/commandError';
+
+export default class WarningListener extends BushListener {
+ public constructor() {
+ super('warning', {
+ emitter: 'process',
+ event: 'warning'
+ });
+ }
+
+ public override async exec(error: Error): Promise<void> {
+ void client.console.warn('warning', `A warning occurred:\n${typeof error == 'object' ? error.stack : error}`, false);
+ void client.console.channelError({
+ embeds: [
+ (await CommandErrorListener.generateErrorEmbed({ type: 'unhandledRejection', error: error }))
+ .setColor(util.colors.warn)
+ .setTitle('A Warning Occurred')
+ ]
+ });
+ }
+}