Skip to content

Commit ad7b7e1

Browse files
committed
Merge branch 'issue-3170' of https://github.com/Jerrie-Aries/modmail into Jerrie-Aries-issue-3170
2 parents fa3ad60 + f68d8a2 commit ad7b7e1

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

bot.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1512,7 +1512,17 @@ async def on_error(self, event_method, *args, **kwargs):
15121512
logger.error("Ignoring exception in %s.", event_method)
15131513
logger.error("Unexpected exception:", exc_info=sys.exc_info())
15141514

1515-
async def on_command_error(self, context, exception):
1515+
async def on_command_error(
1516+
self, context: commands.Context, exception: Exception, *, unhandled_by_cog: bool = False
1517+
) -> None:
1518+
if not unhandled_by_cog:
1519+
command = context.command
1520+
if command and command.has_error_handler():
1521+
return
1522+
cog = context.cog
1523+
if cog and cog.has_error_handler():
1524+
return
1525+
15161526
if isinstance(exception, (commands.BadArgument, commands.BadUnionArgument)):
15171527
await context.typing()
15181528
await context.send(embed=discord.Embed(color=self.error_color, description=str(exception)))

0 commit comments

Comments
 (0)