More elegant exception rethrow

This commit is contained in:
atse 2024-07-08 11:17:44 +08:00
parent 757fd1689a
commit f76b414426

View File

@ -38,8 +38,8 @@ class Client:
self.timeout = timeout
try:
self._reader, self._writer = await self._connecting_task
except asyncio.CancelledError:
raise StoppedConnecting
except asyncio.CancelledError as exc:
raise StoppedConnecting from exc
finally:
self._connecting_task = None