aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRapptz <[email protected]>2019-05-13 21:10:26 -0400
committerRapptz <[email protected]>2019-05-13 22:08:31 -0400
commita4a362b4c749e27595ac692de03e4c75ea8d9eb7 (patch)
tree25309708cdbe02f5fc217e2a62ee3a39fda451f4
parentAdd back __repr__ that were deleted in the Asset redesign (diff)
downloaddiscord.py-a4a362b4c749e27595ac692de03e4c75ea8d9eb7.tar.xz
discord.py-a4a362b4c749e27595ac692de03e4c75ea8d9eb7.zip
[tasks] Log exception when something failed to logging.
-rw-r--r--discord/ext/tasks/__init__.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/discord/ext/tasks/__init__.py b/discord/ext/tasks/__init__.py
index b7b15f1d..649fbd48 100644
--- a/discord/ext/tasks/__init__.py
+++ b/discord/ext/tasks/__init__.py
@@ -3,11 +3,14 @@ import aiohttp
import websockets
import discord
import inspect
+import logging
from discord.backoff import ExponentialBackoff
MAX_ASYNCIO_SECONDS = 3456000
+log = logging.getLogger(__name__)
+
class Loop:
"""A background task helper that abstracts the loop and reconnection logic for you.
@@ -86,6 +89,9 @@ class Loop:
except asyncio.CancelledError:
self._is_being_cancelled = True
raise
+ except Exception as e:
+ log.exception('Internal background task failed.')
+ raise
finally:
await self._call_loop_function('after_loop')
self._is_being_cancelled = False