diff options
author | Devaev Maxim <[email protected]> | 2020-03-20 16:00:15 +0300 |
---|---|---|
committer | Devaev Maxim <[email protected]> | 2020-03-20 16:00:15 +0300 |
commit | 1fdc26f13610d3545aad840392fd223d5f4175b5 (patch) | |
tree | 4815a9bac19febb99dcf0e82a90615f5e64cb855 /kvmd/apps | |
parent | f85ee6b4bfe265a4490ed4dac2da1d88c88bed32 (diff) |
better exc handling
Diffstat (limited to 'kvmd/apps')
-rw-r--r-- | kvmd/apps/vnc/server.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/kvmd/apps/vnc/server.py b/kvmd/apps/vnc/server.py index e55e51a1..b4aa9de7 100644 --- a/kvmd/apps/vnc/server.py +++ b/kvmd/apps/vnc/server.py @@ -36,6 +36,7 @@ from ...logging import get_logger from ... import aiotools +from .rfb import RfbError from .rfb import RfbClient from .kvmd import KvmdClient @@ -125,8 +126,10 @@ class _Client(RfbClient): # pylint: disable=too-many-instance-attributes msg = receive_task.result() if msg.type == aiohttp.WSMsgType.TEXT: await self.__process_ws_event(json.loads(msg.data)) + elif msg.type == aiohttp.WSMsgType.CLOSE: + raise RfbError("KVMD closed the wesocket (it may have been stopped)") else: - raise RuntimeError(f"Unknown WS message type: {msg!r}") + raise RuntimeError(f"Unhandled WS message type: {msg!r}") receive_task = None if writer_task in done: |