aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRapptz <[email protected]>2018-07-20 05:54:51 -0400
committerRapptz <[email protected]>2018-07-20 05:54:51 -0400
commitda5776a35813afe3f293d8a7d75b9b031c78d3bd (patch)
tree971444f62e5ea25c51384b62e64c2876529e04b0
parent[commands] Add support for typing.Union as a converter (diff)
downloaddiscord.py-da5776a35813afe3f293d8a7d75b9b031c78d3bd.tar.xz
discord.py-da5776a35813afe3f293d8a7d75b9b031c78d3bd.zip
[commands] Make ConversionError have the original error as an attribute
-rw-r--r--discord/ext/commands/core.py2
-rw-r--r--discord/ext/commands/errors.py6
2 files changed, 6 insertions, 2 deletions
diff --git a/discord/ext/commands/core.py b/discord/ext/commands/core.py
index 9bb102b5..7a03feb3 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 f3d20ba5..d6443f2f 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