When Promise running throws an uncaught exception - log it

This commit is contained in:
Noam Meltzer 2017-06-03 15:50:18 +03:00
parent 2680740316
commit 0fb00c4c8b

View file

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