From: Benjamin Braatz Date: Tue, 29 Mar 2022 19:10:29 +0000 (+0200) Subject: Catch TimeoutError. X-Git-Tag: v0.3.0~8 X-Git-Url: http://git.graph-it.com/?a=commitdiff_plain;h=3dcc2602f2d6a2a5ded704c7e1f99882860ab50f;p=graphit%2Fcontrolpi-wsclient.git Catch TimeoutError. --- 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: