fix: Command.onError

This commit is contained in:
DjDeveloperr 2021-04-17 13:11:07 +05:30
parent c3d1714a6e
commit b13cdbe480

View file

@ -362,9 +362,11 @@ export class CommandClient extends Client implements CommandClientOptions {
const result = await command.execute(ctx) const result = await command.execute(ctx)
await command.afterExecute(ctx, result) await command.afterExecute(ctx, result)
} catch (e) { } catch (e) {
await command try {
.onError(ctx, e) await command.onError(ctx, e)
.catch((e: Error) => this.emit('commandError', ctx, e)) } catch (e) {
this.emit('commandError', ctx, e)
}
this.emit('commandError', ctx, e) this.emit('commandError', ctx, e)
} }
} }