From 69b0ba4c5cc7e58eb9a98354f3b279621bf8d9f1 Mon Sep 17 00:00:00 2001 From: DJ2LS <75909252+DJ2LS@users.noreply.github.com> Date: Sat, 29 May 2021 15:59:06 +0200 Subject: [PATCH] better error handling --- sock.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sock.py b/sock.py index 68d304ca..34ef9e60 100644 --- a/sock.py +++ b/sock.py @@ -45,11 +45,13 @@ class CMDTCPRequestHandler(socketserver.BaseRequestHandler): # convert data to json object # we need to do some error handling in case of socket timeout + try: received_json = json.loads(data) + print(received_json) except: - pass - print(received_json) + received_json = bytes() + # GET COMMANDS # "command" : "..."