Never hide non-[msgtype/tpt-closed] error tbs in `Channel.send()`

structural_dynamics_of_flow
Tyler Goodlet 2025-04-11 00:00:12 -04:00
parent b700d90e09
commit 9807318e3d
1 changed files with 21 additions and 11 deletions

View File

@ -49,6 +49,7 @@ from tractor.log import get_logger
from tractor._exceptions import ( from tractor._exceptions import (
MsgTypeError, MsgTypeError,
pack_from_raise, pack_from_raise,
TransportClosed,
) )
from tractor.msg import ( from tractor.msg import (
Aid, Aid,
@ -256,7 +257,7 @@ class Channel:
self, self,
payload: Any, payload: Any,
hide_tb: bool = False, hide_tb: bool = True,
) -> None: ) -> None:
''' '''
@ -274,18 +275,27 @@ class Channel:
payload, payload,
hide_tb=hide_tb, hide_tb=hide_tb,
) )
except BaseException as _err: except (
BaseException,
MsgTypeError,
TransportClosed,
)as _err:
err = _err # bind for introspection err = _err # bind for introspection
if not isinstance(_err, MsgTypeError): match err:
# assert err case MsgTypeError():
__tracebackhide__: bool = False try:
else: assert err.cid
try: except KeyError:
assert err.cid raise err
case TransportClosed():
except KeyError: log.transport(
raise err f'Transport stream closed due to\n'
f'{err.repr_src_exc()}\n'
)
case _:
# never suppress non-tpt sources
__tracebackhide__: bool = False
raise raise
async def recv(self) -> Any: async def recv(self) -> Any: