Adjust `Portal` usage of `Context.pld_rx`
Pass the new `ipc` arg and try to show api frames when an unexpected internal error is detected.runtime_to_msgspec
parent
c80f020ebc
commit
30afcd2b6b
|
@ -166,6 +166,7 @@ class Portal:
|
||||||
assert self._expect_result_ctx
|
assert self._expect_result_ctx
|
||||||
|
|
||||||
if self._final_result_msg is None:
|
if self._final_result_msg is None:
|
||||||
|
try:
|
||||||
(
|
(
|
||||||
self._final_result_msg,
|
self._final_result_msg,
|
||||||
self._final_result_pld,
|
self._final_result_pld,
|
||||||
|
@ -173,6 +174,11 @@ class Portal:
|
||||||
ipc=self._expect_result_ctx,
|
ipc=self._expect_result_ctx,
|
||||||
expect_msg=Return,
|
expect_msg=Return,
|
||||||
)
|
)
|
||||||
|
except BaseException as err:
|
||||||
|
# TODO: wrap this into `@api_frame` optionally with
|
||||||
|
# some kinda filtering mechanism like log levels?
|
||||||
|
__tracebackhide__: bool = False
|
||||||
|
raise err
|
||||||
|
|
||||||
return self._final_result_pld
|
return self._final_result_pld
|
||||||
|
|
||||||
|
@ -306,7 +312,7 @@ class Portal:
|
||||||
portal=self,
|
portal=self,
|
||||||
)
|
)
|
||||||
return await ctx._pld_rx.recv_pld(
|
return await ctx._pld_rx.recv_pld(
|
||||||
ctx=ctx,
|
ipc=ctx,
|
||||||
expect_msg=Return,
|
expect_msg=Return,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -325,6 +331,8 @@ class Portal:
|
||||||
remote rpc task or a local async generator instance.
|
remote rpc task or a local async generator instance.
|
||||||
|
|
||||||
'''
|
'''
|
||||||
|
__runtimeframe__: int = 1 # noqa
|
||||||
|
|
||||||
if isinstance(func, str):
|
if isinstance(func, str):
|
||||||
warnings.warn(
|
warnings.warn(
|
||||||
"`Portal.run(namespace: str, funcname: str)` is now"
|
"`Portal.run(namespace: str, funcname: str)` is now"
|
||||||
|
@ -358,7 +366,7 @@ class Portal:
|
||||||
portal=self,
|
portal=self,
|
||||||
)
|
)
|
||||||
return await ctx._pld_rx.recv_pld(
|
return await ctx._pld_rx.recv_pld(
|
||||||
ctx=ctx,
|
ipc=ctx,
|
||||||
expect_msg=Return,
|
expect_msg=Return,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue