File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -488,8 +488,12 @@ async def _signal_exit(self) -> None:
488488 try :
489489 # if the socket connection is closed, the following line might throw an error
490490 await self ._socket .send (json .dumps ({"type" : "CloseStream" }))
491+ except websockets .exceptions .ConnectionClosedOK as e :
492+ self .logger .notice (f"_signal_exit - connection closed: { e .code } " )
493+ except websockets .exceptions .WebSocketException as e :
494+ self .logger .error (f"_signal_exit - WebSocketException: { str (e )} " )
491495 except Exception as e :
492- self .logger .error ("Exception in AsyncLiveClient. _signal_exit, %s" , e )
496+ self .logger .error (f" _signal_exit - Exception: { str ( e ) } " )
493497
494498 await asyncio .sleep (0.5 )
495499
Original file line number Diff line number Diff line change @@ -473,7 +473,15 @@ def _signal_exit(self) -> None:
473473 self .logger .notice ("closing socket..." )
474474 if self ._socket is not None :
475475 self .logger .notice ("sending CloseStream..." )
476- self .send (json .dumps ({"type" : "CloseStream" }))
476+ try :
477+ # if the socket connection is closed, the following line might throw an error
478+ self ._socket .send (json .dumps ({"type" : "CloseStream" }))
479+ except websockets .exceptions .ConnectionClosedOK as e :
480+ self .logger .notice (f"_signal_exit - connection closed: { e .code } " )
481+ except websockets .exceptions .WebSocketException as e :
482+ self .logger .error (f"_signal_exit - WebSocketException: { str (e )} " )
483+ except Exception as e :
484+ self .logger .error (f"_signal_exit - Exception: { str (e )} " )
477485
478486 time .sleep (0.5 )
479487
You can’t perform that action at this time.
0 commit comments