From d0a42775b328247359bc4bc43f11f8449a5adff2 Mon Sep 17 00:00:00 2001 From: Marcus Zuber Date: Thu, 21 May 2015 14:38:22 +0200 Subject: [PATCH] Printing of exception with gevent --- concert/async.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/concert/async.py b/concert/async.py index 75f4bc13a..ad46ac437 100644 --- a/concert/async.py +++ b/concert/async.py @@ -179,6 +179,8 @@ def async(func): @functools.wraps(func) def _inner(*args, **kwargs): g = GreenletFuture(func, args, kwargs) + if concert.config.ENABLE_PRINT_ASYNC_EXCEPTION: + g.link(print_exception) g.start() return g @@ -193,6 +195,11 @@ def _inner(*args, **kwargs): return result return _inner + + def print_exception(g): + if g.saved_exception is not None: + print g.saved_exception + except ImportError: HAVE_GEVENT = False print("Gevent is not available, falling back to threads")