From 0fb00c4c8b6f57fd79d9dd0afd717c5c5f5b983c Mon Sep 17 00:00:00 2001 From: Noam Meltzer Date: Sat, 3 Jun 2017 15:50:18 +0300 Subject: [PATCH] When Promise running throws an uncaught exception - log it --- telegram/utils/promise.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/telegram/utils/promise.py b/telegram/utils/promise.py index 15c474e10..43e2e7599 100644 --- a/telegram/utils/promise.py +++ b/telegram/utils/promise.py @@ -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: