forked from goodboy/tractor
Always raise asyncio errors
parent
d6ddc47e58
commit
57edf481e8
|
@ -158,28 +158,15 @@ async def run_task(
|
|||
with cs:
|
||||
return await from_aio.receive()
|
||||
|
||||
if cs.cancelled_caught:
|
||||
# always raise from any captured asyncio error
|
||||
if from_aio._err:
|
||||
raise from_aio._err
|
||||
|
||||
# Do we need this?
|
||||
except Exception as err:
|
||||
|
||||
aio_err = from_aio._err
|
||||
|
||||
if aio_err is not None:
|
||||
# always raise from any captured asyncio error
|
||||
raise err from aio_err
|
||||
else:
|
||||
raise
|
||||
|
||||
except trio.Cancelled:
|
||||
if not task.done():
|
||||
task.cancel()
|
||||
|
||||
raise
|
||||
|
||||
finally:
|
||||
if from_aio._err:
|
||||
raise from_aio._err
|
||||
|
||||
|
||||
# TODO: explicit api for the streaming case where
|
||||
# we pull from the mem chan in an async generator?
|
||||
|
|
Loading…
Reference in New Issue