From 62607490952511ab5fc41965cea10f9879914c95 Mon Sep 17 00:00:00 2001 From: Christopher F Date: Sat, 20 Oct 2018 10:52:26 -0400 Subject: [PATCH] fix: invoke CommandExecuted on async exception failures --- src/Discord.Net.Commands/Info/CommandInfo.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Discord.Net.Commands/Info/CommandInfo.cs b/src/Discord.Net.Commands/Info/CommandInfo.cs index d27a1ed7b..87434546f 100644 --- a/src/Discord.Net.Commands/Info/CommandInfo.cs +++ b/src/Discord.Net.Commands/Info/CommandInfo.cs @@ -272,6 +272,10 @@ namespace Discord.Commands var wrappedEx = new CommandException(this, context, ex); await Module.Service._cmdLogger.ErrorAsync(wrappedEx).ConfigureAwait(false); + + var result = ExecuteResult.FromError(CommandError.Exception, ex.Message); + await Module.Service._commandExecutedEvent.InvokeAsync(this, context, result).ConfigureAwait(false); + if (Module.Service._throwOnError) { if (ex == originalEx) @@ -280,7 +284,7 @@ namespace Discord.Commands ExceptionDispatchInfo.Capture(ex).Throw(); } - return ExecuteResult.FromError(CommandError.Exception, ex.Message); + return result; } finally {