Hide some stack layers the user doesn't really need to see

egs_with_ctx_res_consumption
Tyler Goodlet 2022-10-12 17:41:01 -04:00
parent c437196d9b
commit 35550dd2a2
3 changed files with 8 additions and 4 deletions

View File

@ -121,10 +121,12 @@ def unpack_error(
err_type=RemoteActorError err_type=RemoteActorError
) -> Exception: ) -> Exception:
"""Unpack an 'error' message from the wire '''
Unpack an 'error' message from the wire
into a local ``RemoteActorError``. into a local ``RemoteActorError``.
""" '''
__tracebackhide__ = True
error = msg['error'] error = msg['error']
tb_str = error.get('tb_str', '') tb_str = error.get('tb_str', '')

View File

@ -52,17 +52,17 @@ log = get_logger(__name__)
def _unwrap_msg( def _unwrap_msg(
msg: dict[str, Any], msg: dict[str, Any],
channel: Channel channel: Channel
) -> Any: ) -> Any:
__tracebackhide__ = True
try: try:
return msg['return'] return msg['return']
except KeyError: except KeyError:
# internal error should never get here # internal error should never get here
assert msg.get('cid'), "Received internal error at portal?" assert msg.get('cid'), "Received internal error at portal?"
raise unpack_error(msg, channel) raise unpack_error(msg, channel) from None
class MessagingError(Exception): class MessagingError(Exception):
@ -136,6 +136,7 @@ class Portal:
Return the result(s) from the remote actor's "main" task. Return the result(s) from the remote actor's "main" task.
''' '''
# __tracebackhide__ = True
# Check for non-rpc errors slapped on the # Check for non-rpc errors slapped on the
# channel for which we always raise # channel for which we always raise
exc = self.channel._exc exc = self.channel._exc

View File

@ -140,6 +140,7 @@ async def exhaust_portal(
If the main task is an async generator do our best to consume If the main task is an async generator do our best to consume
what's left of it. what's left of it.
''' '''
__tracebackhide__ = True
try: try:
log.debug(f"Waiting on final result from {actor.uid}") log.debug(f"Waiting on final result from {actor.uid}")