Include which command failed to build on exception

This commit is contained in:
RogueException
2016-08-28 03:44:20 -03:00
parent 8406bd8f73
commit ab42129eb9

View File

@@ -30,6 +30,8 @@ namespace Discord.Commands
public IReadOnlyList<PreconditionAttribute> Preconditions { get; }
internal Command(MethodInfo source, Module module, object instance, CommandAttribute attribute, string groupPrefix)
{
try
{
Source = source;
Module = module;
@@ -65,6 +67,11 @@ namespace Discord.Commands
Preconditions = BuildPreconditions(source);
_action = BuildAction(source);
}
catch (Exception ex)
{
throw new Exception($"Failed to build command {source.DeclaringType.FullName}.{source.Name}", ex);
}
}
public async Task<PreconditionResult> CheckPreconditions(IUserMessage context)
{