improved config file error handling

This commit is contained in:
DJ2LS 2022-12-04 16:43:50 +01:00
parent 7cd01e1e74
commit 4b5622647e

View file

@ -264,7 +264,7 @@ if __name__ == "__main__":
if ARGS.configfile: if ARGS.configfile:
# init config # init config
config = config.CONFIG().read_config() config = config.CONFIG().read_config()
try:
# additional step for being sure our callsign is correctly # additional step for being sure our callsign is correctly
# in case we are not getting a station ssid # in case we are not getting a station ssid
# then we are forcing a station ssid = 0 # then we are forcing a station ssid = 0
@ -308,7 +308,10 @@ if __name__ == "__main__":
static.RESPOND_TO_CQ = config['TNC']['qrv'] static.RESPOND_TO_CQ = config['TNC']['qrv']
static.RX_BUFFER_SIZE = config['TNC']['rxbuffersize'] static.RX_BUFFER_SIZE = config['TNC']['rxbuffersize']
static.ENABLE_EXPLORER = config['TNC']['explorer'] static.ENABLE_EXPLORER = config['TNC']['explorer']
except KeyError as e:
log.warning("[CFG] Error reading config file near", key=str(e))
except Exception as e:
log.warning("[CFG] Error", e=e)
else: else:
# additional step for being sure our callsign is correctly # additional step for being sure our callsign is correctly