From c437196d9b46464d3ed9e3a94b41c31589778fa8 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Wed, 12 Oct 2022 17:40:08 -0400 Subject: [PATCH] Pack errors from the parent task into the actor nursery --- tractor/_supervise.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tractor/_supervise.py b/tractor/_supervise.py index 65f5e0c..d9bcbab 100644 --- a/tractor/_supervise.py +++ b/tractor/_supervise.py @@ -310,6 +310,7 @@ async def _open_and_supervise_one_cancels_all_nursery( # actors spawned in "daemon mode" (aka started using # ``ActorNursery.start_actor()``). + err: BaseExpection | None = None # errors from this daemon actor nursery bubble up to caller async with trio.open_nursery() as da_nursery: try: @@ -348,6 +349,7 @@ async def _open_and_supervise_one_cancels_all_nursery( except BaseException as err: + errors[actor.uid] = err # If we error in the root but the debugger is # engaged we don't want to prematurely kill (and # thus clobber access to) the local tty since it @@ -383,7 +385,7 @@ async def _open_and_supervise_one_cancels_all_nursery( else: log.exception( f"Nursery for {current_actor().uid} " - f"errored with {err}, ") + f"errored with") # cancel all subactors await anursery.cancel() @@ -412,6 +414,7 @@ async def _open_and_supervise_one_cancels_all_nursery( ) as err: + errors[actor.uid] = err # XXX: yet another guard before allowing the cancel # sequence in case a (single) child is in debug. await maybe_wait_for_debugger(