diff --git a/src/Discord.Net.Interactions/Info/Commands/CommandInfo.cs b/src/Discord.Net.Interactions/Info/Commands/CommandInfo.cs index ea5ded11c..78f0b6000 100644 --- a/src/Discord.Net.Interactions/Info/Commands/CommandInfo.cs +++ b/src/Discord.Net.Interactions/Info/Commands/CommandInfo.cs @@ -200,6 +200,7 @@ namespace Discord.Interactions while (ex is TargetInvocationException) ex = ex.InnerException; + var interactionException = new InteractionException(this, context, ex); await Module.CommandService._cmdLogger.ErrorAsync(ex).ConfigureAwait(false); var result = ExecuteResult.FromError(ex); diff --git a/src/Discord.Net.Interactions/InteractionException.cs b/src/Discord.Net.Interactions/InteractionException.cs new file mode 100644 index 000000000..c1d4c3f45 --- /dev/null +++ b/src/Discord.Net.Interactions/InteractionException.cs @@ -0,0 +1,17 @@ +using System; + +namespace Discord.Interactions +{ + public class InteractionException : Exception + { + public ICommandInfo CommandInfo { get; } + public IInteractionContext InteractionContext { get; } + + public InteractionException(ICommandInfo commandInfo, IInteractionContext context, Exception exception) + : base($"Error occurred executing {commandInfo}.", exception) + { + CommandInfo = commandInfo; + InteractionContext = context; + } + } +}