From b13cdbe4806ac15ac3e6a6520caeb8624cd0c3c4 Mon Sep 17 00:00:00 2001 From: DjDeveloperr Date: Sat, 17 Apr 2021 13:11:07 +0530 Subject: [PATCH] fix: Command.onError --- src/commands/client.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/commands/client.ts b/src/commands/client.ts index 9cc8f54..824746e 100644 --- a/src/commands/client.ts +++ b/src/commands/client.ts @@ -362,9 +362,11 @@ export class CommandClient extends Client implements CommandClientOptions { const result = await command.execute(ctx) await command.afterExecute(ctx, result) } catch (e) { - await command - .onError(ctx, e) - .catch((e: Error) => this.emit('commandError', ctx, e)) + try { + await command.onError(ctx, e) + } catch (e) { + this.emit('commandError', ctx, e) + } this.emit('commandError', ctx, e) } }