From 0062c96a3c7fa726d4c4921022ba99468f87a097 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Fri, 4 Mar 2022 08:55:24 -0500 Subject: [PATCH] Log cancels with appropriate level --- tractor/to_asyncio.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tractor/to_asyncio.py b/tractor/to_asyncio.py index a19afe1..aeb376a 100644 --- a/tractor/to_asyncio.py +++ b/tractor/to_asyncio.py @@ -271,7 +271,12 @@ def _run_asyncio_task( task.exception() except BaseException as terr: task_err = terr - log.exception(f'`asyncio` task: {task.get_name()} errored') + + if isinstance(terr, CancelledError): + log.cancel(f'`asyncio` task cancelled: {task.get_name()}') + else: + log.exception(f'`asyncio` task: {task.get_name()} errored') + assert type(terr) is type(aio_err), 'Asyncio task error mismatch?' if aio_err is not None: