diff options
-rw-r--r-- | bitbake/lib/bb/asyncrpc/client.py | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/bitbake/lib/bb/asyncrpc/client.py b/bitbake/lib/bb/asyncrpc/client.py index 9be49261c0..17b72033b9 100644 --- a/bitbake/lib/bb/asyncrpc/client.py +++ b/bitbake/lib/bb/asyncrpc/client.py | |||
@@ -112,11 +112,16 @@ class AsyncClient(object): | |||
112 | ) | 112 | ) |
113 | 113 | ||
114 | async def connect_sock(): | 114 | async def connect_sock(): |
115 | websocket = await websockets.connect( | 115 | try: |
116 | uri, | 116 | websocket = await websockets.connect( |
117 | ping_interval=None, | 117 | uri, |
118 | open_timeout=self.timeout, | 118 | ping_interval=None, |
119 | ) | 119 | open_timeout=self.timeout, |
120 | ) | ||
121 | except asyncio.exceptions.TimeoutError: | ||
122 | raise ConnectionError("Timeout while connecting to websocket") | ||
123 | except (OSError, websockets.InvalidHandshake, websockets.InvalidURI) as exc: | ||
124 | raise ConnectionError(f"Could not connect to websocket: {exc}") from exc | ||
120 | return WebsocketConnection(websocket, self.timeout) | 125 | return WebsocketConnection(websocket, self.timeout) |
121 | 126 | ||
122 | self._connect_sock = connect_sock | 127 | self._connect_sock = connect_sock |