diff options
author | 2020-02-27 19:43:45 -0800 | |
---|---|---|
committer | 2020-02-27 19:44:32 -0800 | |
commit | 4096ef526aba41ab3fd83be16ef3b5554419d524 (patch) | |
tree | 1f68504c03dc785b90ceceac5dd60ca6f073f06c | |
parent | Scheduler: only send warning in callback if task isn't cancelled (diff) |
Scheduler: log the exception instead of raising
Logging it ourselves has a cleaner traceback and gives more control
over the output, such as including the task ID.
-rw-r--r-- | bot/utils/scheduling.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/bot/utils/scheduling.py b/bot/utils/scheduling.py index 9371dcdb7..1eae817c1 100644 --- a/bot/utils/scheduling.py +++ b/bot/utils/scheduling.py @@ -95,6 +95,9 @@ class Scheduler(metaclass=CogABCMeta): with contextlib.suppress(asyncio.CancelledError): exception = done_task.exception() - # Raise the exception if one exists. + # Log the exception if one exists. if exception: - raise exception + log.error( + f"{self.cog_name}: error in task #{task_id} {id(scheduled_task)}!", + exc_info=exception + ) |