using System;
namespace Discord.Commands
{
///
/// The exception that is thrown if another exception occurs during a command execution.
///
public class CommandException : Exception
{
/// Gets the command that caused the exception.
public CommandInfo Command { get; }
/// Gets the command context of the exception.
public ICommandContext Context { get; }
///
/// Initializes a new instance of the class using a
/// information, a context, and the exception that
/// interrupted the execution.
///
/// The command information.
/// The context of the command.
/// The exception that interrupted the command execution.
public CommandException(CommandInfo command, ICommandContext context, Exception ex)
: base($"Error occurred executing {command.GetLogText(context)}.", ex)
{
Command = command;
Context = context;
}
}
}