mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-07 03:38:53 -05:00
Fix CancelledError handling in done callbacks of cog init tasks (#6203)
This commit is contained in:
parent
bad23a4a93
commit
d8e584b5e8
@ -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,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user