[commands] Properly propagate CommandError derived exceptions.

If a command or a group raised a CommandError derived exception it
would be wrapped into CommandInvokeError. This fixes this case so it
raises the original exception instead.
This commit is contained in:
Rapptz 2016-12-17 14:44:36 -05:00
parent 6d88024f0f
commit b8909ae389

View File

@ -48,6 +48,8 @@ def inject_context(ctx, coro):
try:
ret = yield from coro(*args, **kwargs)
except CommandError:
raise
except Exception as e:
raise CommandInvokeError(e) from e
return ret