From fe0916de973bce38d1a58f72dde65b2fa81d33b3 Mon Sep 17 00:00:00 2001 From: neodarz Date: Fri, 10 May 2019 22:47:49 +0200 Subject: Raise error instead of simple print it in bluez mode --- parrot_zik/bluezutils.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'parrot_zik') 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 -- cgit v1.2.1