diff --git a/tractor/_runtime.py b/tractor/_runtime.py index 2ece8340b..f1fb03419 100644 --- a/tractor/_runtime.py +++ b/tractor/_runtime.py @@ -197,8 +197,8 @@ async def _invoke( except trio.MultiError: # 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 diff --git a/tractor/_streaming.py b/tractor/_streaming.py index e0879a3a9..1bccb89d9 100644 --- a/tractor/_streaming.py +++ b/tractor/_streaming.py @@ -330,8 +330,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') @@ -373,7 +373,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 @@ -450,7 +450,7 @@ 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 @@ -458,7 +458,7 @@ async def _maybe_raise_from_remote_msg( 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()