[tasks] Log exception when something failed to logging.

This commit is contained in:
Rapptz 2019-05-13 21:10:26 -04:00
parent a62641bd65
commit a4a362b4c7

View File

@ -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