diff options
| author | Rapptz <[email protected]> | 2016-01-13 20:08:55 -0500 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2016-01-13 20:08:55 -0500 |
| commit | 4edff12f6bd711e546d5cdc29663cece8c2ba4a9 (patch) | |
| tree | 290473c34855a2cfbf7f528a201a3f3b55d6a9f5 /discord/ext | |
| parent | Guild member add will include deaf and mute now, do not provide default values (diff) | |
| download | discord.py-4edff12f6bd711e546d5cdc29663cece8c2ba4a9.tar.xz discord.py-4edff12f6bd711e546d5cdc29663cece8c2ba4a9.zip | |
Proper exception chaining.
Diffstat (limited to 'discord/ext')
| -rw-r--r-- | discord/ext/commands/bot.py | 4 | ||||
| -rw-r--r-- | discord/ext/commands/core.py | 8 |
2 files changed, 6 insertions, 6 deletions
diff --git a/discord/ext/commands/bot.py b/discord/ext/commands/bot.py index 9507dbe2..24e1d4b9 100644 --- a/discord/ext/commands/bot.py +++ b/discord/ext/commands/bot.py @@ -456,8 +456,8 @@ class Bot(GroupMixin, discord.Client): lib = importlib.import_module(name) try: lib.setup(self) - except AttributeError: - raise discord.ClientException('extension does not have a setup function') + except AttributeError as e: + raise discord.ClientException('extension does not have a setup function') from e self.extensions[name] = lib diff --git a/discord/ext/commands/core.py b/discord/ext/commands/core.py index 846b33c4..db597734 100644 --- a/discord/ext/commands/core.py +++ b/discord/ext/commands/core.py @@ -183,8 +183,8 @@ class Command: elif converter is discord.Invite: try: return bot.get_invite(argument.strip()) - except: - raise BadArgument('Invite is invalid') + except Exception as e: + raise BadArgument('Invite is invalid') from e def _get_converter(self, param): converter = param.annotation @@ -217,8 +217,8 @@ class Command: return self.do_conversion(ctx.bot, ctx.message, converter, argument) except CommandError as e: raise e - except Exception: - raise BadArgument('Converting to "{0.__name__}" failed.'.format(converter)) + except Exception as e: + raise BadArgument('Converting to "{0.__name__}" failed.'.format(converter)) from e @property def clean_params(self): |