Skip to content

Commit

Permalink
Printing of exception with gevent
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcusZuber committed May 21, 2015
1 parent ab7c5f4 commit d0a4277
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions concert/async.py
Expand Up @@ -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

Expand All @@ -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")
Expand Down

0 comments on commit d0a4277

Please sign in to comment.