mirror of
https://github.com/python-telegram-bot/python-telegram-bot.git
synced 2025-01-03 09:49:21 +01:00
When Promise running throws an uncaught exception - log it
This commit is contained in:
parent
2680740316
commit
0fb00c4c8b
1 changed files with 6 additions and 0 deletions
|
@ -18,9 +18,14 @@
|
|||
# along with this program. If not, see [http://www.gnu.org/licenses/].
|
||||
""" This module contains the Promise class """
|
||||
|
||||
import logging
|
||||
from threading import Event
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
logger.addHandler(logging.NullHandler())
|
||||
|
||||
|
||||
class Promise(object):
|
||||
"""A simple Promise implementation for the run_async decorator"""
|
||||
|
||||
|
@ -37,6 +42,7 @@ class Promise(object):
|
|||
self._result = self.pooled_function(*self.args, **self.kwargs)
|
||||
|
||||
except Exception as exc:
|
||||
logger.exception('An uncaught error was raised while running the promise')
|
||||
self._exception = exc
|
||||
|
||||
finally:
|
||||
|
|
Loading…
Reference in a new issue