From a2199782f17691af028b25340eb676696d5dbbd2 Mon Sep 17 00:00:00 2001 From: Benjamin Braatz Date: Wed, 11 Aug 2021 09:45:23 +0200 Subject: [PATCH] Catch InvalidMessage exception. --- controlpi_plugins/wsclient.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/controlpi_plugins/wsclient.py b/controlpi_plugins/wsclient.py index 73e9f23..f0a2263 100644 --- a/controlpi_plugins/wsclient.py +++ b/controlpi_plugins/wsclient.py @@ -3,7 +3,7 @@ import fcntl import json import socket import struct -from websockets.exceptions import ConnectionClosed +from websockets.exceptions import ConnectionClosed, InvalidMessage from websockets.legacy.client import connect, WebSocketClientProtocol from controlpi import BasePlugin, Message, MessageTemplate @@ -196,6 +196,6 @@ class WSClient(BasePlugin): await self.bus.send(Message(self.name, {'event': 'connection closed'})) - except OSError: + except (OSError, InvalidMessage): pass await asyncio.sleep(1) -- 2.34.1