tractor/tractor
Tyler Goodlet cbd47d800e Add `MsgTypeError` "bad msg" capture
Such that if caught by user code and/or the runtime we can introspect
the original msg which caused the type error. Previously this was kinda
half-baked with a `.msg_dict` which was delivered from an `Any`-decode
of the shuttle msg in `_mk_msg_type_err()` but now this more explicitly
refines the API and supports both `PayloadMsg`-instance or the msg-dict
style injection:
- allow passing either of `bad_msg: PayloadMsg|None` or
  `bad_msg_as_dict: dict|None` to `MsgTypeError.from_decode()`.
- expose public props for both ^ whilst dropping prior `.msgdict`.
- rework `.from_decode()` to explicitly accept `**extra_msgdata: dict`
  |_ only overriding it from any `bad_msg_as_dict` if the keys are found in
    `_ipcmsg_keys`, **except** for `_bad_msg` when `bad_msg` is passed.
  |_ drop `.ipc_msg` passthrough.
  |_ drop `msgdict` input.
- adjust `.cid` to only pull from the `.bad_msg` if set.

Related fixes/adjustments:
- `pack_from_raise()` should pull `boxed_type_str` from
  `boxed_type.__name__`, not the `type()` of it.. also add a
  `hide_tb: bool` flag.
- don't include `_msg_dict` and `_bad_msg` in the `_body_fields` set.
- allow more granular boxed traceback-str controls:
  |_ allow passing a `tb_str: str` explicitly in which case we use it
    verbatim and presume caller knows what they're doing.
  |_ when not provided, use the more explicit
    `traceback.format_exception(exc)` since the error instance is
    a required input (we still fail back to the old `.format_exc()` call
    if for some reason the caller passes `None`; but that should be
    a bug right?).
  |_ if a `tb: TracebackType` and a `tb_str` is passed, concat them.
- in `RemoteActorError.pformat()` don't indent the `._message` part used
  for the `body` when `with_type_header == False`.
- update `_mk_msg_type_err()` to use `bad_msg`/`bad_msg_as_dict`
  appropriately and drop passing `ipc_msg`.
2025-03-24 14:04:51 -04:00
..
_testing Start a new `._testing.fault_simulation` 2025-03-24 14:04:51 -04:00
devx Move runtime frame hiding into helper func 2025-03-24 14:04:51 -04:00
experimental Drop now-deprecated deps on modern `trio`/Python 2025-03-16 16:06:24 -04:00
msg More correct/explicit `.started()` send-side validation 2025-03-24 14:04:51 -04:00
trionics Drop now-deprecated deps on modern `trio`/Python 2025-03-16 16:06:24 -04:00
__init__.py Expose `tractor.current_ipc_ctx()` at pkg level 2025-03-24 14:04:51 -04:00
_child.py Hide `._entry`/`._child` frames, tweak some more type annots 2025-03-20 23:22:45 -04:00
_clustering.py Passthrough runtime kwargs from `open_actor_cluster()` 2022-12-11 19:56:08 -05:00
_context.py More correct/explicit `.started()` send-side validation 2025-03-24 14:04:51 -04:00
_discovery.py More spaceless union type annots 2025-03-20 19:50:31 -04:00
_entry.py Call `.devx._debug.hide_runtime_frames()` by default 2025-03-24 14:04:51 -04:00
_exceptions.py Add `MsgTypeError` "bad msg" capture 2025-03-24 14:04:51 -04:00
_forkserver_override.py Re-license code base for distribution under AGPL 2021-12-14 23:33:27 -05:00
_ipc.py Shield channel closing in `_connect_chan()` 2025-03-24 14:04:51 -04:00
_mp_fixup_main.py Avoid importing mp for as long as possible 2022-02-17 11:55:26 -05:00
_multiaddr.py Fix doc string "its" typo.. 2025-03-20 19:50:31 -04:00
_portal.py Adjust `Portal` usage of `Context.pld_rx` 2025-03-24 14:04:51 -04:00
_root.py Call `.devx._debug.hide_runtime_frames()` by default 2025-03-24 14:04:51 -04:00
_rpc.py Set `_ctxvar_Context` for child-side RPC tasks 2025-03-24 14:04:51 -04:00
_runtime.py Port `Actor._stream_handler()` to use `.has_outcome`, fix indent bug.. 2025-03-24 14:04:51 -04:00
_spawn.py Add debug check-n-wait inside `._spawn.soft_kill()` 2025-03-24 14:04:51 -04:00
_state.py Add error suppress flag to `current_ipc_ctx()` 2025-03-24 14:04:51 -04:00
_streaming.py Allocate a `PldRx` per `Context`, new pld-spec API 2025-03-24 14:04:51 -04:00
_supervise.py Show runtime nursery frames on internal errors 2025-03-24 14:04:51 -04:00
log.py Bleh, make `log.devx()` level less then cancel but > `.runtime()` 2025-03-20 23:22:45 -04:00
to_asyncio.py Provision for infected-`asyncio` debug mode support 2025-03-20 22:37:51 -04:00