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, Context,
) )
from ._exceptions import ( from ._exceptions import (
ModuleNotExposed,
is_multi_cancelled,
ContextCancelled, ContextCancelled,
ModuleNotExposed,
MsgTypeError,
TransportClosed,
is_multi_cancelled,
pack_error, pack_error,
unpack_error, unpack_error,
TransportClosed,
) )
from .devx import ( from .devx import (
maybe_wait_for_debugger, maybe_wait_for_debugger,
@ -636,7 +637,7 @@ async def _invoke(
# (callee) task, so relay this cancel signal to the # (callee) task, so relay this cancel signal to the
# other side. # other side.
ctxc = ContextCancelled( ctxc = ContextCancelled(
msg, message=msg,
boxed_type=trio.Cancelled, boxed_type=trio.Cancelled,
canceller=canceller, canceller=canceller,
) )
@ -826,7 +827,12 @@ async def process_messages(
| Stop(cid=cid) | Stop(cid=cid)
| Return(cid=cid) | Return(cid=cid)
| CancelAck(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 # deliver response to local caller/waiter
# via its per-remote-context memory channel. # via its per-remote-context memory channel.