Skip to content

Commit

Permalink
Prevent "Future exception was never retrieved" error when the future …
Browse files Browse the repository at this point in the history
…is not used
  • Loading branch information
kozlovsky committed Apr 26, 2022
1 parent 9f82a4d commit d97c30f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/tribler/core/components/ipv8/eva_protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,10 @@ def finish(self, result: Union[TransferResult | TransferException]):
if isinstance(result, TransferException):
logger.warning(f'Finish with exception: {result.__class__.__name__}: {result}, Peer: {self.peer}')
self.future.set_exception(result)

# To prevent "Future exception was never retrieved" error when the future is not used
self.future.exception()

if self.protocol.on_error:
asyncio.create_task(self.protocol.on_error(self.peer, result))
else:
Expand Down

0 comments on commit d97c30f

Please sign in to comment.