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 self.timeout = timeout
try: try:
self._reader, self._writer = await self._connecting_task self._reader, self._writer = await self._connecting_task
except asyncio.CancelledError: except asyncio.CancelledError as exc:
raise StoppedConnecting raise StoppedConnecting from exc
finally: finally:
self._connecting_task = None self._connecting_task = None