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 Jan 30, 2023
1 parent 33b0e36 commit 6120e99
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 @@ -342,8 +342,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 @@ -385,7 +385,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 @@ -462,15 +462,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 6120e99

Please sign in to comment.