diff options
| -rw-r--r-- | bot/converters.py | 5 | ||||
| -rw-r--r-- | bot/exts/backend/error_handler.py | 6 |
2 files changed, 7 insertions, 4 deletions
diff --git a/bot/converters.py b/bot/converters.py index 880b1fe38..d0a9731d6 100644 --- a/bot/converters.py +++ b/bot/converters.py @@ -575,10 +575,7 @@ class Infraction(Converter): return infractions[0] else: - try: - return await ctx.bot.api_client.get(f"bot/infractions/{arg}") - except ResponseCodeError: - raise BadArgument("The provided infraction could not be found.") + return await ctx.bot.api_client.get(f"bot/infractions/{arg}") Expiry = t.Union[Duration, ISODateTime] diff --git a/bot/exts/backend/error_handler.py b/bot/exts/backend/error_handler.py index b8bb3757f..8923a6b3d 100644 --- a/bot/exts/backend/error_handler.py +++ b/bot/exts/backend/error_handler.py @@ -85,6 +85,12 @@ class ErrorHandler(Cog): else: await self.handle_unexpected_error(ctx, e.original) return # Exit early to avoid logging. + elif isinstance(e, errors.ConversionError): + if isinstance(e.original, ResponseCodeError): + await self.handle_api_error(ctx, e.original) + else: + await self.handle_unexpected_error(ctx, e.original) + return # Exit early to avoid logging. elif not isinstance(e, errors.DisabledCommand): # ConversionError, MaxConcurrencyReached, ExtensionError await self.handle_unexpected_error(ctx, e) |