mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-12-05 17:02:32 -05:00
Fix CancelledError handling in done callbacks of cog init tasks (#6203)
This commit is contained in:
@@ -98,8 +98,13 @@ class Downloader(commands.Cog):
|
||||
|
||||
def create_init_task(self):
|
||||
def _done_callback(task: asyncio.Task) -> None:
|
||||
try:
|
||||
exc = task.exception()
|
||||
if exc is not None:
|
||||
except asyncio.CancelledError:
|
||||
pass
|
||||
else:
|
||||
if exc is None:
|
||||
return
|
||||
log.error(
|
||||
"An unexpected error occurred during Downloader's initialization.",
|
||||
exc_info=exc,
|
||||
|
||||
@@ -117,8 +117,13 @@ class Mutes(VoiceMutes, commands.Cog, metaclass=CompositeMetaClass):
|
||||
|
||||
def create_init_task(self) -> None:
|
||||
def _done_callback(task: asyncio.Task) -> None:
|
||||
try:
|
||||
exc = task.exception()
|
||||
if exc is not None:
|
||||
except asyncio.CancelledError:
|
||||
pass
|
||||
else:
|
||||
if exc is None:
|
||||
return
|
||||
log.error(
|
||||
"An unexpected error occurred during Mutes's initialization.",
|
||||
exc_info=exc,
|
||||
|
||||
Reference in New Issue
Block a user