From 04f5f2fa8497185838bcd2a09a256a2018940ffe Mon Sep 17 00:00:00 2001 From: Bonta-kun <40473493+Bonta0@users.noreply.github.com> Date: Mon, 16 Dec 2019 18:39:00 +0100 Subject: [PATCH] Multi client/server: log fewer exceptions --- MultiClient.py | 4 ++-- MultiServer.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/MultiClient.py b/MultiClient.py index cd9c997b..fd7cfa9a 100644 --- a/MultiClient.py +++ b/MultiClient.py @@ -410,7 +410,7 @@ async def snes_recv_loop(ctx : Context): print("Snes disconnected, type /snes to reconnect") except Exception as e: print("Lost connection to the snes, type /snes to reconnect") - if type(e) is not websockets.ConnectionClosed: + if not isinstance(e, websockets.WebSocketException): logging.exception(e) finally: socket, ctx.snes_socket = ctx.snes_socket, None @@ -561,7 +561,7 @@ async def server_loop(ctx : Context): print('Failed to connect to the multiworld server') except Exception as e: print('Lost connection to the multiworld server, type /connect to reconnect') - if type(e) is not websockets.ConnectionClosed: + if not isinstance(e, websockets.WebSocketException): logging.exception(e) finally: ctx.name = None diff --git a/MultiServer.py b/MultiServer.py index 9a2a1c92..cb753721 100644 --- a/MultiServer.py +++ b/MultiServer.py @@ -102,7 +102,7 @@ async def server(websocket, path, ctx : Context): args = msg[1] await process_client_cmd(ctx, client, cmd, args) except Exception as e: - if type(e) is not websockets.ConnectionClosed: + if not isinstance(e, websockets.WebSocketException): logging.exception(e) finally: await on_client_disconnected(ctx, client)