mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-04-20 16:00:29 +00:00
[tasks] Log exception when something failed to logging.
This commit is contained in:
parent
a62641bd65
commit
a4a362b4c7
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user