From da5776a35813afe3f293d8a7d75b9b031c78d3bd Mon Sep 17 00:00:00 2001 From: Rapptz Date: Fri, 20 Jul 2018 05:54:51 -0400 Subject: [PATCH] [commands] Make ConversionError have the original error as an attribute --- discord/ext/commands/core.py | 2 +- discord/ext/commands/errors.py | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/discord/ext/commands/core.py b/discord/ext/commands/core.py index 9bb102b58..7a03feb3f 100644 --- a/discord/ext/commands/core.py +++ b/discord/ext/commands/core.py @@ -239,7 +239,7 @@ class Command: except CommandError as e: raise e except Exception as e: - raise ConversionError(converter) from e + raise ConversionError(converter, e) from e try: return converter(argument) diff --git a/discord/ext/commands/errors.py b/discord/ext/commands/errors.py index f3d20ba57..d6443f2fa 100644 --- a/discord/ext/commands/errors.py +++ b/discord/ext/commands/errors.py @@ -57,11 +57,15 @@ class ConversionError(CommandError): ---------- converter: :class:`discord.ext.commands.Converter` The converter that failed. + original + The original exception that was raised. You can also get this via + the ``__cause__`` attribute. This inherits from :exc:`.CommandError`. """ - def __init__(self, converter): + def __init__(self, converter, original): self.converter = converter + self.original = original class UserInputError(CommandError): """The base exception type for errors that involve errors