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")