diff --git a/src/socketio/async_client.py b/src/socketio/async_client.py index c7f5e86e..0fa35dc6 100644 --- a/src/socketio/async_client.py +++ b/src/socketio/async_client.py @@ -158,7 +158,7 @@ async def connect(self, url, headers={}, auth=None, transports=None, await self._handle_reconnect() if self.eio.state == 'connected': return - raise exceptions.ConnectionError(exc.args[0]) from None + raise exceptions.ConnectionError(exc.args[0]) from exc if wait: try: diff --git a/src/socketio/client.py b/src/socketio/client.py index 746d2c4c..84b1643d 100644 --- a/src/socketio/client.py +++ b/src/socketio/client.py @@ -156,7 +156,7 @@ def connect(self, url, headers={}, auth=None, transports=None, self._handle_reconnect() if self.eio.state == 'connected': return - raise exceptions.ConnectionError(exc.args[0]) from None + raise exceptions.ConnectionError(exc.args[0]) from exc if wait: while self._connect_event.wait(timeout=wait_timeout):