From 12a702374ac28d597369382b561c9282835e9c62 Mon Sep 17 00:00:00 2001 From: Rapptz Date: Wed, 20 Sep 2023 17:20:50 -0400 Subject: [PATCH] [commands] Log exceptions that happen during cog_unload --- discord/ext/commands/cog.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/discord/ext/commands/cog.py b/discord/ext/commands/cog.py index 5429e90f2..16d398763 100644 --- a/discord/ext/commands/cog.py +++ b/discord/ext/commands/cog.py @@ -24,6 +24,7 @@ DEALINGS IN THE SOFTWARE. from __future__ import annotations import inspect +import logging from discord.utils import maybe_coroutine, MISSING from typing import Any, Callable, Dict, Generator, List, Optional, TYPE_CHECKING, Tuple, TypeVar @@ -44,6 +45,8 @@ __all__ = ( FuncT = TypeVar('FuncT', bound=Callable[..., Any]) +_log = logging.getLogger(__name__) + class CogMeta(type): """A metaclass for defining a cog. @@ -508,4 +511,4 @@ 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)