From 57edf481e8cf687fb1b0ef7d36d04bf4acd85047 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Tue, 7 Sep 2021 16:59:11 -0400 Subject: [PATCH] Always raise asyncio errors --- tractor/to_asyncio.py | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/tractor/to_asyncio.py b/tractor/to_asyncio.py index c7bcc89..128f8d0 100644 --- a/tractor/to_asyncio.py +++ b/tractor/to_asyncio.py @@ -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?