From 9bdeeb2ef1f7698d84adb3662d429c9b643cf864 Mon Sep 17 00:00:00 2001 From: Mingcan Li Date: Tue, 5 Mar 2024 17:46:51 -0600 Subject: [PATCH] change connection status to false on error --- Backend/core/comms.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Backend/core/comms.py b/Backend/core/comms.py index 3ed6b47d..c632c5d8 100644 --- a/Backend/core/comms.py +++ b/Backend/core/comms.py @@ -67,7 +67,7 @@ def listen_udp(self, port: int): frontend_data = d.copy() try: db.insert_data(d) - except exception: + except Exception as e: print(traceback.format_exc()) continue solar_car_connection['udp'] = True @@ -75,6 +75,7 @@ def listen_udp(self, port: int): # Timeout occurred, handle as needed solar_car_connection['udp'] = False except Exception as e: + solar_car_connection['udp'] = False print(f"Exception in UDP thread {e}") continue @@ -178,6 +179,7 @@ async def remote_db_fetch(self, server_url: str): solar_car_connection['lte'] = False break except Exception as e: + solar_car_connection['lte'] = False print(f"Error in the LTE thread: {e}") continue