Added except block to args.host to handle connection errors for the CLI.

This commit is contained in:
Timothy Harder
2024-01-07 12:37:13 -06:00
parent 6dcdf7fc19
commit b11edacee0

View File

@@ -948,9 +948,14 @@ def common():
if args.ble:
client = BLEInterface(args.ble, debugOut=logfile, noProto=args.noproto)
elif args.host:
client = meshtastic.tcp_interface.TCPInterface(
args.host, debugOut=logfile, noProto=args.noproto
)
try:
client = meshtastic.tcp_interface.TCPInterface(
args.host, debugOut=logfile, noProto=args.noproto
)
except Exception as ex:
meshtastic.util.our_exit(
f"Error connecting to {args.host}:{ex}", 1
)
else:
try:
client = meshtastic.serial_interface.SerialInterface(