fix: handle uncaught UnicodeDecodeError
UnicodeDecodeError occurred when trying to connect to the server with HTTPS. The error was not caught by the broad Exception clause in `handle_agent`, causing a traceback to be dumped.
This commit is contained in:
parent
f71d86fce7
commit
6c0eb7f941
@ -87,6 +87,8 @@ class Server:
|
|||||||
conn.send(json.dumps({"command": command}).encode())
|
conn.send(json.dumps({"command": command}).encode())
|
||||||
except json.decoder.JSONDecodeError:
|
except json.decoder.JSONDecodeError:
|
||||||
logger.error(f"Invalid JSON received from {addr}")
|
logger.error(f"Invalid JSON received from {addr}")
|
||||||
|
except UnicodeDecodeError:
|
||||||
|
logger.error(f"Invalid UTF-8 received from {addr}")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"Error handling agent {agent_id}: {e}")
|
logger.error(f"Error handling agent {agent_id}: {e}")
|
||||||
finally:
|
finally:
|
||||||
|
Loading…
Reference in New Issue
Block a user