diff options
| author | Rapptz <[email protected]> | 2017-01-15 21:55:50 -0500 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2017-01-15 21:55:50 -0500 |
| commit | ea72d5e63d6005765809ce0b2ed24153166b89d4 (patch) | |
| tree | e9d683bba8dccc0cfde113a63508b8b18b960ac4 | |
| parent | [commands] Change UserConverter to actually work with User, not Member. (diff) | |
| download | discord.py-ea72d5e63d6005765809ce0b2ed24153166b89d4.tar.xz discord.py-ea72d5e63d6005765809ce0b2ed24153166b89d4.zip | |
[commands] Guarantee that local error handler is called before generic.
| -rw-r--r-- | discord/ext/commands/bot.py | 2 | ||||
| -rw-r--r-- | discord/ext/commands/core.py | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/discord/ext/commands/bot.py b/discord/ext/commands/bot.py index 8c17c63b..56c9c153 100644 --- a/discord/ext/commands/bot.py +++ b/discord/ext/commands/bot.py @@ -632,7 +632,7 @@ class BotBase(GroupMixin): try: yield from ctx.command.invoke(ctx) except CommandError as e: - ctx.command.dispatch_error(e, ctx) + yield from ctx.command.dispatch_error(e, ctx) else: self.dispatch('command_completion', ctx) elif ctx.invoked_with: diff --git a/discord/ext/commands/core.py b/discord/ext/commands/core.py index 1a5d076d..c3e2b413 100644 --- a/discord/ext/commands/core.py +++ b/discord/ext/commands/core.py @@ -145,18 +145,18 @@ class Command: self.parent = None self._buckets = CooldownMapping(kwargs.get('cooldown')) + @asyncio.coroutine def dispatch_error(self, error, ctx): try: coro = self.on_error except AttributeError: pass else: - loop = ctx.bot.loop injected = wrap_callback(coro) if self.instance is not None: - discord.compat.create_task(injected(self.instance, error, ctx), loop=loop) + yield from injected(self.instance, error, ctx) else: - discord.compat.create_task(injected(error, ctx), loop=loop) + yield from injected(error, ctx) finally: ctx.bot.dispatch('command_error', error, ctx) |