[commands] Make ConversionError have the original error as an attribute
This commit is contained in:
parent
92dde9aef9
commit
da5776a358
@ -239,7 +239,7 @@ class Command:
|
|||||||
except CommandError as e:
|
except CommandError as e:
|
||||||
raise e
|
raise e
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise ConversionError(converter) from e
|
raise ConversionError(converter, e) from e
|
||||||
|
|
||||||
try:
|
try:
|
||||||
return converter(argument)
|
return converter(argument)
|
||||||
|
@ -57,11 +57,15 @@ class ConversionError(CommandError):
|
|||||||
----------
|
----------
|
||||||
converter: :class:`discord.ext.commands.Converter`
|
converter: :class:`discord.ext.commands.Converter`
|
||||||
The converter that failed.
|
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`.
|
This inherits from :exc:`.CommandError`.
|
||||||
"""
|
"""
|
||||||
def __init__(self, converter):
|
def __init__(self, converter, original):
|
||||||
self.converter = converter
|
self.converter = converter
|
||||||
|
self.original = original
|
||||||
|
|
||||||
class UserInputError(CommandError):
|
class UserInputError(CommandError):
|
||||||
"""The base exception type for errors that involve errors
|
"""The base exception type for errors that involve errors
|
||||||
|
Loading…
x
Reference in New Issue
Block a user