mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
More robust error handling for simple_worker
This commit is contained in:
parent
7580d9c1c0
commit
fa0b3854a4
@ -48,7 +48,7 @@ class ConnectedWorker(Thread):
|
|||||||
try:
|
try:
|
||||||
eintr_retry_call(conn.send, self.args)
|
eintr_retry_call(conn.send, self.args)
|
||||||
self.res = eintr_retry_call(conn.recv)
|
self.res = eintr_retry_call(conn.recv)
|
||||||
except:
|
except BaseException:
|
||||||
self.tb = traceback.format_exc()
|
self.tb = traceback.format_exc()
|
||||||
|
|
||||||
def communicate(ans, worker, listener, args, timeout=300, heartbeat=None,
|
def communicate(ans, worker, listener, args, timeout=300, heartbeat=None,
|
||||||
@ -77,6 +77,8 @@ def communicate(ans, worker, listener, args, timeout=300, heartbeat=None,
|
|||||||
|
|
||||||
if cw.tb:
|
if cw.tb:
|
||||||
raise WorkerError('Failed to communicate with worker process')
|
raise WorkerError('Failed to communicate with worker process')
|
||||||
|
if cw.res is None:
|
||||||
|
raise WorkerError('Something strange happened. The worker process was aborted without an exception.')
|
||||||
if cw.res.get('tb', None):
|
if cw.res.get('tb', None):
|
||||||
raise WorkerError('Worker failed', cw.res['tb'])
|
raise WorkerError('Worker failed', cw.res['tb'])
|
||||||
ans['result'] = cw.res['result']
|
ans['result'] = cw.res['result']
|
||||||
|
Loading…
x
Reference in New Issue
Block a user