diff --git a/WayKey/cli/main.py b/WayKey/cli/main.py index 2d65a61..6edadbb 100644 --- a/WayKey/cli/main.py +++ b/WayKey/cli/main.py @@ -15,6 +15,9 @@ def send_command(command: dict) -> dict: client.sendall(json.dumps(command).encode('utf-8')) response = client.recv(4096).decode('utf-8') return json.loads(response) + except socket.error as e: + print("Could not connect to the WayKey daemon. Is it running?") + return {"status": "error", "message": str(e)} finally: client.close() diff --git a/WayKey/library/commands.py b/WayKey/library/commands.py index 7f301a5..d9d6cda 100644 --- a/WayKey/library/commands.py +++ b/WayKey/library/commands.py @@ -14,6 +14,9 @@ def _send_command(command: dict) -> dict: client.sendall(json.dumps(command).encode('utf-8')) response = client.recv(4096).decode('utf-8') return json.loads(response) + except socket.error as err: + print("Could not connect to the WayKey daemon. Is it running?") + return {"status": "error", "message": str(err)} finally: client.close()