add exception log output

This commit is contained in:
KF7EEL 2021-02-26 09:46:27 -08:00
parent 22a87ea3d5
commit 15dab47dd6
1 changed files with 15 additions and 9 deletions

View File

@ -70,12 +70,12 @@ from gps_functions import cmd_list
# Module for maidenhead grids
try:
import maidenhead as mh
except:
except Exception as error_exception:
logger.info('Error importing maidenhead module, make sure it is installed.')
# Module for sending email
try:
import smtplib
except:
except Exception as error_exception:
logger.info('Error importing smtplib module, make sure it is installed.')
#Modules for APRS settings
@ -252,7 +252,7 @@ def process_sms(_rf_src, sms):
try:
send_email(to_email, email_subject, email_message)
logger.info('Email sent.')
except:
except Exception as error_exception:
logger.info('Failed to send email.')
elif '@MH' in sms:
grid_square = re.sub('@MH ', '', sms)
@ -308,8 +308,9 @@ def process_sms(_rf_src, sms):
aprs_send(aprs_loc_packet)
dashboard_loc_write(str(get_alias(int_id(_rf_src), subscriber_ids)) + '-' + ssid, aprs_lat, aprs_lon, time.strftime('%H:%M:%S - %m/%d/%y'))
#logger.info('Sent manual position to APRS')
except:
except Exception as error_exception:
logger.info('Exception. Not uploaded')
logger.info(error_exception)
packet_assembly = ''
@ -329,16 +330,18 @@ def process_sms(_rf_src, sms):
aprslib.parse(aprs_msg_pkt)
aprs_send(aprs_msg_pkt)
#logger.info('Packet sent.')
except:
except Exception as error_exception:
logger.info('Error uploading MSG packet.')
logger.info(error_exception)
try:
if sms in cmd_list:
logger.info('Executing command/script.')
os.popen(cmd_list[sms]).read()
packet_assembly = ''
except:
except Exception as error_exception:
logger.info('Exception. Command possibly not in list, or other error.')
packet_assembly = ''
logger.info(error_exception)
else:
pass
@ -436,8 +439,9 @@ class DATA_SYSTEM(HBSYSTEM):
aprs_send(aprs_loc_packet)
dashboard_loc_write(str(get_alias(int_id(_rf_src), subscriber_ids)) + '-' + ssid, aprs_lat, aprs_lon, time.strftime('%H:%M:%S - %m/%d/%y'))
#logger.info('Sent APRS packet')
except:
except Exception as error_exception:
logger.info('Error. Failed to send packet. Packet may be malformed.')
logger.info(error_exception)
udt_block = 1
hdr_type = ''
else:
@ -522,9 +526,10 @@ class DATA_SYSTEM(HBSYSTEM):
logger.info('User comment: ' + comment)
logger.info('User SSID: ' + ssid)
logger.info('User icon: ' + icon_table + icon_icon)
except:
except Exception as error_exception:
logger.info('Error or user settings file not found, proceeding with default settings.')
aprs_loc_packet = str(get_alias(int_id(_rf_src), subscriber_ids)) + '-' + str(user_ssid) + '>APHBL3,TCPIP*:/' + str(datetime.datetime.utcnow().strftime("%H%M%Sh")) + str(loc.lat[0:7]) + str(loc.lat_dir) + '/' + str(loc.lon[0:8]) + str(loc.lon_dir) + '[' + str(round(loc.true_course)).zfill(3) + '/' + str(round(loc.spd_over_grnd)).zfill(3) + '/' + aprs_comment + ' DMR ID: ' + str(int_id(_rf_src))
logger.info(error_exception)
try:
# Try parse of APRS packet. If it fails, it will not upload to APRS-IS
aprslib.parse(aprs_loc_packet)
@ -533,8 +538,9 @@ class DATA_SYSTEM(HBSYSTEM):
float(loc.lon)
aprs_send(aprs_loc_packet)
dashboard_loc_write(str(get_alias(int_id(_rf_src), subscriber_ids)) + '-' + ssid, str(loc.lat[0:7]) + str(loc.lat_dir), str(loc.lon[0:8]) + str(loc.lon_dir), time.strftime('%H:%M:%S - %m/%d/%y'))
except:
except Exception as error_exception:
logger.info('Failed to parse packet. Packet may be deformed. Not uploaded.')
logger.info(error_exception)
#final_packet = ''
# Get callsign based on DMR ID
# End APRS-IS upload