Fixed RunMode.Sync running Async. Added ThrowOnError option.

This commit is contained in:
RogueException
2017-03-18 21:38:28 -03:00
parent 83bd16f329
commit 3fb21e06c2
3 changed files with 11 additions and 3 deletions

View File

@@ -140,7 +140,7 @@ namespace Discord.Commands
switch (RunMode)
{
case RunMode.Sync: //Always sync
var t1 = ExecuteAsyncInternal(context, args, map);
await ExecuteAsyncInternal(context, args, map).ConfigureAwait(false);
break;
case RunMode.Async: //Always async
var t2 = Task.Run(async () =>
@@ -168,7 +168,8 @@ namespace Discord.Commands
{
ex = new CommandException(this, context, ex);
await Module.Service._cmdLogger.ErrorAsync(ex).ConfigureAwait(false);
throw;
if (Module.Service._throwOnError)
throw;
}
await Module.Service._cmdLogger.VerboseAsync($"Executed {GetLogText(context)}").ConfigureAwait(false);
}