From f76b4144265adc7964f388d8550c8d26a5b348d0 Mon Sep 17 00:00:00 2001 From: atse Date: Mon, 8 Jul 2024 11:17:44 +0800 Subject: [PATCH] More elegant exception rethrow --- pytec/pytec/aioclient.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pytec/pytec/aioclient.py b/pytec/pytec/aioclient.py index d939329..30264f1 100644 --- a/pytec/pytec/aioclient.py +++ b/pytec/pytec/aioclient.py @@ -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