fix: server correctly handles non-JSON payloads

This commit addresses the server not handling non-JSON payloads correctly.
Fixes #2
This commit is contained in:
agatha 2024-09-07 15:38:51 -04:00
parent 3c72572ba4
commit d7151ca5b0

View File

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