Skip to content

Commit

Permalink
Catch bleak errors in scan tool
Browse files Browse the repository at this point in the history
  • Loading branch information
Jakeler committed May 26, 2021
1 parent 22d5fd2 commit ca3f4d8
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion ble_serial/scan/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from bleak import BleakScanner, BleakClient
from bleak.backends.service import BleakGATTServiceCollection
from bleak.exc import BleakError
import argparse, asyncio


Expand Down Expand Up @@ -50,5 +51,8 @@ def main():
help='Try to connect to device and read out service/characteristic UUIDs')
args = parser.parse_args()

asyncio.run(scan(args))
try:
asyncio.run(scan(args))
except BleakError as be:
print('ERROR:', be)

0 comments on commit ca3f4d8

Please sign in to comment.