From 33f2234baf246f22393c8454c2e0df8eb826a682 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Wed, 12 Oct 2022 17:41:01 -0400 Subject: [PATCH] Hide some stack layers the user doesn't really need to see --- tractor/_exceptions.py | 6 ++++-- tractor/_portal.py | 5 +++-- tractor/_spawn.py | 1 + 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/tractor/_exceptions.py b/tractor/_exceptions.py index 89ad3f9..5440cad 100644 --- a/tractor/_exceptions.py +++ b/tractor/_exceptions.py @@ -121,10 +121,12 @@ def unpack_error( err_type=RemoteActorError ) -> Exception: - """Unpack an 'error' message from the wire + ''' + Unpack an 'error' message from the wire into a local ``RemoteActorError``. - """ + ''' + __tracebackhide__ = True error = msg['error'] tb_str = error.get('tb_str', '') diff --git a/tractor/_portal.py b/tractor/_portal.py index 18b73ac..089b09e 100644 --- a/tractor/_portal.py +++ b/tractor/_portal.py @@ -52,17 +52,17 @@ log = get_logger(__name__) def _unwrap_msg( - msg: dict[str, Any], channel: Channel ) -> Any: + __tracebackhide__ = True try: return msg['return'] except KeyError: # internal error should never get here assert msg.get('cid'), "Received internal error at portal?" - raise unpack_error(msg, channel) + raise unpack_error(msg, channel) from None class MessagingError(Exception): @@ -136,6 +136,7 @@ class Portal: Return the result(s) from the remote actor's "main" task. ''' + # __tracebackhide__ = True # Check for non-rpc errors slapped on the # channel for which we always raise exc = self.channel._exc diff --git a/tractor/_spawn.py b/tractor/_spawn.py index 68d8a41..7380ea0 100644 --- a/tractor/_spawn.py +++ b/tractor/_spawn.py @@ -140,6 +140,7 @@ async def exhaust_portal( If the main task is an async generator do our best to consume what's left of it. ''' + __tracebackhide__ = True try: log.debug(f"Waiting on final result from {actor.uid}")