From d7151ca5b09aa26baccd4514d3bf02022200f179 Mon Sep 17 00:00:00 2001 From: agatha Date: Sat, 7 Sep 2024 15:38:51 -0400 Subject: [PATCH] fix: server correctly handles non-JSON payloads This commit addresses the server not handling non-JSON payloads correctly. Fixes #2 --- server/src/main.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/server/src/main.py b/server/src/main.py index 62582a2..a838154 100644 --- a/server/src/main.py +++ b/server/src/main.py @@ -83,6 +83,8 @@ class Server: else: command = "nop" conn.send(json.dumps({"command": command}).encode()) + except json.decoder.JSONDecodeError: + logger.error(f"Invalid JSON received from {addr}") except Exception as e: logger.error(f"Error handling agent {agent_id}: {e}") finally: