Skip to content

Commit b11edac

Browse files
committed
Added except block to args.host to handle connection errors for the CLI.
1 parent 6dcdf7f commit b11edac

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

meshtastic/__main__.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -948,9 +948,14 @@ def common():
948948
if args.ble:
949949
client = BLEInterface(args.ble, debugOut=logfile, noProto=args.noproto)
950950
elif args.host:
951-
client = meshtastic.tcp_interface.TCPInterface(
952-
args.host, debugOut=logfile, noProto=args.noproto
953-
)
951+
try:
952+
client = meshtastic.tcp_interface.TCPInterface(
953+
args.host, debugOut=logfile, noProto=args.noproto
954+
)
955+
except Exception as ex:
956+
meshtastic.util.our_exit(
957+
f"Error connecting to {args.host}:{ex}", 1
958+
)
954959
else:
955960
try:
956961
client = meshtastic.serial_interface.SerialInterface(

0 commit comments

Comments
 (0)