Make a nicer error when the robot isn't found.

This commit is contained in:
Danny Staple
2023-01-19 23:12:21 +00:00
parent a509fa540c
commit fa67d9e21a
6 changed files with 33 additions and 21 deletions
+1 -2
View File
@@ -9,8 +9,7 @@ async def run():
print([device.name for device in devices])
matching_devices = [device for device in devices if device.name==ble_name]
if len(matching_devices) == 0:
print(f"Could not find robot at {ble_name}")
return
raise RuntimeError("Could not find robot")
ble_device_info = matching_devices[0]
print(f"Found robot {ble_device_info.name}...")