From 50085de7dba57de380a8798ae091943729aa7c8d Mon Sep 17 00:00:00 2001 From: W1CDN Date: Tue, 12 Dec 2023 20:25:00 -0600 Subject: [PATCH] Try to catch exceptions. --- kiss_and_db.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/kiss_and_db.py b/kiss_and_db.py index 9d4739f..453fa47 100644 --- a/kiss_and_db.py +++ b/kiss_and_db.py @@ -66,15 +66,18 @@ def main(): try: try: a = aprslib.parse(str(frame)) - except: - logging.error("Error with aprslib!") + except Exception as error: + logging.error("Error with aprslib:", error) a['station_call'] = config['Settings']['station_call'] a['station_lat'] = config['Settings']['station_lat'] a['station_lon'] = config['Settings']['station_lon'] a['created_unix'] = int(time.time()) - print(a) + # Make this a string and deal with it later (probably a mistake) a['path'] = str(a['path']) + if 'subpacket' in a: + a['subpacket'] = str(a['subpacket']) + #logging.debug(a['path']) # Store true/false as 1/0 if 'alive' in a: if a['alive'] == True: @@ -121,9 +124,9 @@ def main(): except: #print("Error with SQLite!") logging.error("Error with SQLite!") - except: + except Exception as error: #print("Frame could not be parsed.") - logging.error("Frame could not be parsed.") + logging.error("Frame could not be parsed:", error) conn.close()