Skip to content

Commit 0fb00c4

Browse files
committed
When Promise running throws an uncaught exception - log it
1 parent 2680740 commit 0fb00c4

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

telegram/utils/promise.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,14 @@
1818
# along with this program. If not, see [http://www.gnu.org/licenses/].
1919
""" This module contains the Promise class """
2020

21+
import logging
2122
from threading import Event
2223

2324

25+
logger = logging.getLogger(__name__)
26+
logger.addHandler(logging.NullHandler())
27+
28+
2429
class Promise(object):
2530
"""A simple Promise implementation for the run_async decorator"""
2631

@@ -37,6 +42,7 @@ def run(self):
3742
self._result = self.pooled_function(*self.args, **self.kwargs)
3843

3944
except Exception as exc:
45+
logger.exception('An uncaught error was raised while running the promise')
4046
self._exception = exc
4147

4248
finally:

0 commit comments

Comments
 (0)