Skip to content

Commit

Permalink
Rename ._error -> ._remote_ctx_error
Browse files Browse the repository at this point in the history
  • Loading branch information
goodboy committed Dec 12, 2022
1 parent eb3d0a8 commit 2fe9a1a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions tractor/_runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,8 @@ async def _invoke(
except BaseExceptionGroup:
# if a context error was set then likely
# thei multierror was raised due to that
if ctx._error is not None:
raise ctx._error from None
if ctx._remote_ctx_error is not None:
raise ctx._remote_ctx_error from None

raise

Expand Down
10 changes: 5 additions & 5 deletions tractor/_streaming.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,8 +333,8 @@ async def send(
Send a message over this stream to the far end.
'''
if self._ctx._error:
raise self._ctx._error # from None
if self._ctx._remote_ctx_error:
raise self._ctx._remote_ctx_error # from None

if self._closed:
raise trio.ClosedResourceError('This stream was already closed')
Expand Down Expand Up @@ -376,7 +376,7 @@ class Context:
_portal: Optional[Portal] = None # type: ignore # noqa
_stream: Optional[MsgStream] = None
_result: Optional[Any] = False
_error: Optional[BaseException] = None
_remote_ctx_error: Optional[BaseException] = None

# status flags
_cancel_called: bool = False
Expand Down Expand Up @@ -453,15 +453,15 @@ async def _maybe_raise_from_remote_msg(
f'{msg["error"]["tb_str"]}'
)

self._error = error
self._remote_ctx_error = error

# TODO: tempted to **not** do this by-reraising in a
# nursery and instead cancel a surrounding scope, detect
# the cancellation, then lookup the error that was set?
if self._scope_nursery:

async def raiser():
raise self._error from None
raise self._remote_ctx_error from None

# from trio.testing import wait_all_tasks_blocked
# await wait_all_tasks_blocked()
Expand Down

0 comments on commit 2fe9a1a

Please sign in to comment.