Skip to content

Commit

Permalink
ping_enumerator: Use try except block in PingDevice construction
Browse files Browse the repository at this point in the history
Signed-off-by: Patrick José Pereira <[email protected]>
  • Loading branch information
patrickelectric committed Jan 14, 2020
1 parent f672caf commit fafbd8a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion tools/ping_enumerator.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,12 @@ def detect_device(self, dev):
device was not detected
"""

ping = PingDevice("/dev/serial/by-id/" + dev, 115200)
try:
ping = PingDevice("/dev/serial/by-id/" + dev, 115200)
except Exception as exception:
print("An exception has occurred: ", exception)
return None

if not ping.initialize():
return None

Expand Down

0 comments on commit fafbd8a

Please sign in to comment.