From 2cf87146a30cbc31c2f1f1ffd8b92cc1b5f4cb47 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Sat, 12 Sep 2020 11:41:17 -0400 Subject: [PATCH] Log any asyncio error --- tractor/to_asyncio.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tractor/to_asyncio.py b/tractor/to_asyncio.py index 0f22300..59db280 100644 --- a/tractor/to_asyncio.py +++ b/tractor/to_asyncio.py @@ -94,6 +94,8 @@ async def run_task( """ nonlocal err err = task.exception() + if err: + log.exception(f"asyncio task errorred:\n{err}") cancel_scope.cancel() task.add_done_callback(cancel_trio) @@ -114,6 +116,7 @@ async def run_task( # simple async func elif inspect.iscoroutine(coro): + with cancel_scope: # return single value return await from_aio.receive() @@ -121,6 +124,7 @@ async def run_task( raise err + def run_as_asyncio_guest( trio_main: Callable, ) -> None: