aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Numerlor <[email protected]>2020-02-26 21:58:08 +0100
committerGravatar Numerlor <[email protected]>2020-02-26 21:58:08 +0100
commit97b07a8be526b62db0b1b072b4d9773bff7a8db1 (patch)
tree14726f00b1871b063578c8b40b706f3b696200eb
parentRemove logging from tag converters. (diff)
Log invalid tag names in the error handler tag fallback.
-rw-r--r--bot/cogs/error_handler.py18
1 files changed, 13 insertions, 5 deletions
diff --git a/bot/cogs/error_handler.py b/bot/cogs/error_handler.py
index 3486a746c..fff1f8c9f 100644
--- a/bot/cogs/error_handler.py
+++ b/bot/cogs/error_handler.py
@@ -89,12 +89,20 @@ class ErrorHandler(Cog):
return
# Return to not raise the exception
- with contextlib.suppress(BadArgument, ResponseCodeError):
- await ctx.invoke(
- tags_get_command,
- tag_name=await TagNameConverter.convert(ctx, ctx.invoked_with)
+ try:
+ tag_name = await TagNameConverter.convert(ctx, ctx.invoked_with)
+ except BadArgument:
+ log.debug(
+ f"{ctx.author} tried to use an invalid command "
+ f"and the fallback tag failed validation in TagNameConverter."
)
- return
+ else:
+ with contextlib.suppress(ResponseCodeError):
+ await ctx.invoke(
+ tags_get_command,
+ tag_name=tag_name
+ )
+ return
elif isinstance(e, BadArgument):
await ctx.send(f"Bad argument: {e}\n")
await ctx.invoke(*help_command)