From 3f92f35bb1ca61051ef9c502c6812585df1b6bab Mon Sep 17 00:00:00 2001 From: Rapptz <rapptz@gmail.com> Date: Wed, 20 Sep 2023 17:20:50 -0400 Subject: [PATCH] [commands] Log exceptions that happen during cog_unload --- discord/ext/commands/cog.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/discord/ext/commands/cog.py b/discord/ext/commands/cog.py index f2004c93e..4ccc1f4ec 100644 --- a/discord/ext/commands/cog.py +++ b/discord/ext/commands/cog.py @@ -25,6 +25,7 @@ from __future__ import annotations import inspect import discord +import logging from discord import app_commands from discord.utils import maybe_coroutine, _to_kebab_case @@ -65,6 +66,7 @@ __all__ = ( FuncT = TypeVar('FuncT', bound=Callable[..., Any]) MISSING: Any = discord.utils.MISSING +_log = logging.getLogger(__name__) class CogMeta(type): @@ -769,7 +771,7 @@ class Cog(metaclass=CogMeta): try: await maybe_coroutine(self.cog_unload) except Exception: - pass + _log.exception('Ignoring exception in cog unload for Cog %r (%r)', cls, self.qualified_name) class GroupCog(Cog):