Skip to content

Commit

Permalink
Log context cancellation using .cancel() loglevel
Browse files Browse the repository at this point in the history
  • Loading branch information
goodboy committed Jan 30, 2023
1 parent c9eb466 commit a71a958
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions tractor/_streaming.py
Original file line number Diff line number Diff line change
Expand Up @@ -444,19 +444,24 @@ async def _maybe_raise_from_remote_msg(
# (currently) that other portal APIs (``Portal.run()``,
# ``.run_in_actor()``) do their own error checking at the point
# of the call and result processing.
log.error(
f'Remote context error for {self.chan.uid}:{self.cid}:\n'
f'{msg["error"]["tb_str"]}'
)
error = unpack_error(msg, self.chan)
if (
isinstance(error, ContextCancelled) and
self._cancel_called
isinstance(error, ContextCancelled)
):
# this is an expected cancel request response message
# and we don't need to raise it in scope since it will
# potentially override a real error
return
log.cancel(
f'Remote context error for {self.chan.uid}:{self.cid}:\n'
f'{msg["error"]["tb_str"]}'
)
if self._cancel_called:
# this is an expected cancel request response message
# and we don't need to raise it in scope since it will
# potentially override a real error
return
else:
log.error(
f'Remote context error for {self.chan.uid}:{self.cid}:\n'
f'{msg["error"]["tb_str"]}'
)

self._error = error

Expand Down

0 comments on commit a71a958

Please sign in to comment.