From 3dcc2602f2d6a2a5ded704c7e1f99882860ab50f Mon Sep 17 00:00:00 2001 From: Benjamin Braatz Date: Tue, 29 Mar 2022 21:10:29 +0200 Subject: [PATCH] Catch TimeoutError. --- controlpi_plugins/wsclient.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/controlpi_plugins/wsclient.py b/controlpi_plugins/wsclient.py index dd6dc96..c833c39 100644 --- a/controlpi_plugins/wsclient.py +++ b/controlpi_plugins/wsclient.py @@ -1,5 +1,5 @@ import asyncio -import concurrent.futures +import asyncio.exceptions import fcntl import json import socket @@ -195,8 +195,9 @@ class WSClient(BasePlugin): await self.bus.send(Message(self.name, {'event': 'connection closed'})) - except (OSError, InvalidMessage, concurrent.futures.TimeoutError): - pass + except (OSError, InvalidMessage, + asyncio.exceptions.TimeoutError) as e: + print(f"WSClient to {self.conf['url']}: {e}") await asyncio.sleep(1) async def _send(self, json_message: str) -> None: -- 2.34.1