Multi client/server: log fewer exceptions

This commit is contained in:
Bonta-kun 2019-12-16 18:39:00 +01:00
parent ec1b9eca43
commit 04f5f2fa84
2 changed files with 3 additions and 3 deletions

View File

@ -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

View File

@ -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)