aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar MarkKoz <[email protected]>2019-09-14 18:20:22 -0700
committerGravatar MarkKoz <[email protected]>2019-09-14 19:05:44 -0700
commit4a5ea8cd1fc13de8c419ef48b42dc11f5bba6705 (patch)
tree030736729061fa45b12a60f24b284b97a37a9a66
parentGenerate InChannelCheckFailure's message inside the exception (diff)
Ignore handled errors by checking for a "handled" attribute
-rw-r--r--bot/cogs/error_handler.py5
-rw-r--r--bot/cogs/moderation.py1
2 files changed, 3 insertions, 3 deletions
diff --git a/bot/cogs/error_handler.py b/bot/cogs/error_handler.py
index 1f0700f28..033a49d39 100644
--- a/bot/cogs/error_handler.py
+++ b/bot/cogs/error_handler.py
@@ -43,9 +43,8 @@ class ErrorHandler:
else:
help_command = (self.bot.get_command("help"),)
- cog_has_handler = command and hasattr(ctx.cog, f"_{command.cog_name}__error")
- if hasattr(command, "on_error") or cog_has_handler:
- log.debug(f"Command {command} has a local error handler; ignoring.")
+ if hasattr(e, "handled"):
+ log.trace(f"Command {command} had its error already handled locally; ignoring.")
return
# Try to look for a tag with the command's name if the command isn't found.
diff --git a/bot/cogs/moderation.py b/bot/cogs/moderation.py
index 63c0e4417..fb791c933 100644
--- a/bot/cogs/moderation.py
+++ b/bot/cogs/moderation.py
@@ -1378,6 +1378,7 @@ class Moderation(Scheduler):
if isinstance(error, BadUnionArgument):
if User in error.converters:
await ctx.send(str(error.errors[0]))
+ error.handled = True
async def respect_role_hierarchy(self, ctx: Context, target: UserTypes, infr_type: str) -> bool:
"""