Added error handling
This commit is contained in:
parent
ee4e3227b4
commit
a0db0dd040
6
droid.py
6
droid.py
|
@ -137,7 +137,11 @@ async def main():
|
||||||
await d.led_off("1f")
|
await d.led_off("1f")
|
||||||
await d.play_sound("00", "00")
|
await d.play_sound("00", "00")
|
||||||
sleep(10)
|
sleep(10)
|
||||||
|
|
||||||
|
except OSError as err:
|
||||||
|
print(f"Discovery failed due to operating system: {err}")
|
||||||
|
except BleakError as err:
|
||||||
|
print(f"Discovery failed due to Bleak: {err}")
|
||||||
|
|
||||||
finally:
|
finally:
|
||||||
await d.disconnect()
|
await d.disconnect()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user