Relay `MsgTypeError`s upward in RPC loop via `._deliver_ctx_payload()`

runtime_to_msgspec
Tyler Goodlet 2024-04-09 13:58:10 -04:00
parent 8839bb06a3
commit af013912ac
1 changed files with 11 additions and 5 deletions

View File

@ -47,12 +47,13 @@ from ._context import (
Context,
)
from ._exceptions import (
ModuleNotExposed,
is_multi_cancelled,
ContextCancelled,
ModuleNotExposed,
MsgTypeError,
TransportClosed,
is_multi_cancelled,
pack_error,
unpack_error,
TransportClosed,
)
from .devx import (
maybe_wait_for_debugger,
@ -636,7 +637,7 @@ async def _invoke(
# (callee) task, so relay this cancel signal to the
# other side.
ctxc = ContextCancelled(
msg,
message=msg,
boxed_type=trio.Cancelled,
canceller=canceller,
)
@ -826,7 +827,12 @@ async def process_messages(
| Stop(cid=cid)
| Return(cid=cid)
| CancelAck(cid=cid)
| Error(cid=cid) # RPC-task ctx specific
# `.cid` means RPC-ctx-task specific
| Error(cid=cid)
# recv-side `MsgType` decode violation
| MsgTypeError(cid=cid)
):
# deliver response to local caller/waiter
# via its per-remote-context memory channel.