Try to catch exceptions.

This commit is contained in:
W1CDN 2023-12-12 20:25:00 -06:00
parent e7002c712c
commit 50085de7db

View File

@ -66,15 +66,18 @@ def main():
try: try:
try: try:
a = aprslib.parse(str(frame)) a = aprslib.parse(str(frame))
except: except Exception as error:
logging.error("Error with aprslib!") logging.error("Error with aprslib:", error)
a['station_call'] = config['Settings']['station_call'] a['station_call'] = config['Settings']['station_call']
a['station_lat'] = config['Settings']['station_lat'] a['station_lat'] = config['Settings']['station_lat']
a['station_lon'] = config['Settings']['station_lon'] a['station_lon'] = config['Settings']['station_lon']
a['created_unix'] = int(time.time()) a['created_unix'] = int(time.time())
print(a)
# Make this a string and deal with it later (probably a mistake) # Make this a string and deal with it later (probably a mistake)
a['path'] = str(a['path']) a['path'] = str(a['path'])
if 'subpacket' in a:
a['subpacket'] = str(a['subpacket'])
#logging.debug(a['path'])
# Store true/false as 1/0 # Store true/false as 1/0
if 'alive' in a: if 'alive' in a:
if a['alive'] == True: if a['alive'] == True:
@ -121,9 +124,9 @@ def main():
except: except:
#print("Error with SQLite!") #print("Error with SQLite!")
logging.error("Error with SQLite!") logging.error("Error with SQLite!")
except: except Exception as error:
#print("Frame could not be parsed.") #print("Frame could not be parsed.")
logging.error("Frame could not be parsed.") logging.error("Frame could not be parsed:", error)
conn.close() conn.close()