File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed
Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -273,6 +273,10 @@ async def async_connect(self) -> None:
273273 if self .connected :
274274 LOG .debug ("Websocket: async_connect() called but already connected" )
275275 return
276+
277+ if self ._api .session .closed :
278+ LOG .error ("Websocket: Cannot connect, session is closed" )
279+ raise CannotConnectError ("Session is closed" )
276280
277281 LOG .info ("Websocket: Connecting to server %s" , self ._api .endpoint )
278282 if self ._api .log_traces :
@@ -344,6 +348,9 @@ async def async_listen(self) -> None:
344348 messages = await self ._async_receive_json ()
345349 for msg in messages :
346350 self ._parse_message (msg )
351+ except asyncio .CancelledError :
352+ LOG .info ("Websocket: Listen cancelled." )
353+ raise
347354 except ConnectionClosedError as err :
348355 LOG .error (f"Websocket: Closed while listening: { err } " )
349356 LOG .exception (err )
You can’t perform that action at this time.
0 commit comments