Added descriptive FileNotFoundError handler for serial device connection

- Added a detailed error message for FileNotFoundError when the serial device is not found.
- Included troubleshooting steps for common issues.
This commit is contained in:
tache
2025-02-09 14:23:31 -05:00
parent 6ec506fe3b
commit 8c115dc636

View File

@@ -1245,6 +1245,19 @@ def common():
noProto=args.noproto,
noNodes=args.no_nodes,
)
except FileNotFoundError:
# Handle the case where the serial device is not found
message = (
f"File Not Found Error:\n"
)
message += f" The serial device at '{args.port}' was not found.\n"
message += " Please check the following:\n"
message += " 1. Is the device connected properly?\n"
message += " 2. Is the correct serial port specified?\n"
message += " 3. Are the necessary drivers installed?\n"
message += " 4. Are you using a **power-only USB cable**? A power-only cable cannot transmit data.\n"
message += " Ensure you are using a **data-capable USB cable**.\n"
meshtastic.util.our_exit(message, 1)
except PermissionError as ex:
username = os.getlogin()
message = "Permission Error:\n"