re-raise async exceptions in main thread

This commit is contained in:
Mike Fährmann
2016-07-24 22:16:59 +02:00
parent 0e20be5a0a
commit f0f7306db6

View File

@@ -55,6 +55,8 @@ class AsynchronousExtractor(Extractor):
task = get() task = get()
if task is None: if task is None:
return return
if isinstance(task, Exception):
raise task
yield task yield task
done() done()
@@ -63,9 +65,8 @@ class AsynchronousExtractor(Extractor):
try: try:
for task in self.items(): for task in self.items():
put(task) put(task)
except Exception: except Exception as e:
import traceback put(e)
print(traceback.format_exc())
put(None) put(None)