aboutsummaryrefslogtreecommitdiff
path: root/parrot_zik
diff options
context:
space:
mode:
authorneodarz <neodarz@neodarz.net>2019-05-10 22:47:49 +0200
committerneodarz <neodarz@neodarz.net>2019-05-10 22:47:49 +0200
commitfe0916de973bce38d1a58f72dde65b2fa81d33b3 (patch)
treea78f99c4a4c8c2fb26960f44f7f42308e919fb82 /parrot_zik
parentc033a187bf02a1419248ea85fd6e09d8d2f95bfd (diff)
downloadpyParrotZikTCP-fe0916de973bce38d1a58f72dde65b2fa81d33b3.tar.xz
pyParrotZikTCP-fe0916de973bce38d1a58f72dde65b2fa81d33b3.zip
Raise error instead of simple print it in bluez mode
Diffstat (limited to 'parrot_zik')
-rw-r--r--parrot_zik/bluezutils.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/parrot_zik/bluezutils.py b/parrot_zik/bluezutils.py
index 6f49f2b..b0684a1 100644
--- a/parrot_zik/bluezutils.py
+++ b/parrot_zik/bluezutils.py
@@ -23,7 +23,7 @@ def find_adapter_in_objects(objects, pattern=None):
path.endswith(pattern):
obj = bus.get_object(SERVICE_NAME, path)
return dbus.Interface(obj, ADAPTER_INTERFACE)
- raise Exception("Bluetooth adapter not found")
+ raise BluetoothAdaptaterNotFound
def find_device(device_address, adapter_pattern=None):
return find_device_in_objects(get_managed_objects(), device_address,
@@ -44,5 +44,10 @@ def find_device_in_objects(objects, device_address, adapter_pattern=None):
obj = bus.get_object(SERVICE_NAME, path)
return dbus.Interface(obj, DEVICE_INTERFACE)
- raise Exception("Bluetooth device not found")
+ raise BluetoothDeviceNotFound
+class BluetoothAdaptaterNotFound(Exception):
+ pass
+
+class BluetoothDeviceNotFound(Exception):
+ pass