From bec2712eb4c43708f37bd5961d69f6b138fc0517 Mon Sep 17 00:00:00 2001 From: Philip Withnall <philip.withnall@collabora.co.uk> Date: Mon, 14 Dec 2015 15:33:05 +0000 Subject: [PATCH] =?UTF-8?q?bluez:=20Fix=20naked=20=E2=80=98raise=E2=80=99?= =?UTF-8?q?=20statements?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When raising an exception, it’s generally a good idea to actually include the exception value — otherwise Python will re-raise the ‘last exception which was active in the current scope’, which is not so useful, especially when you want to print that exception. Reviewed-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk> Signed-off-by: Philip Withnall <philip.withnall@collabora.co.uk> Differential Revision: https://phabricator.apertis.org/D1296 --- bluez/ubt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bluez/ubt b/bluez/ubt index a314046..bccc6ab 100755 --- a/bluez/ubt +++ b/bluez/ubt @@ -464,7 +464,7 @@ class PbapDeviceProfileTester(DeviceProfileTester): path = s[0] break if not path: - raise + raise LookupError('Device ‘%s’ not found in services' % device_name) service = dbus.Interface(bus.get_object("net.connman", path), "net.connman.Service") @@ -517,7 +517,7 @@ class PbapDeviceProfileTester(DeviceProfileTester): if ret == 'y' or ret == 'Y': TEST_PASSED("A2DP Source") else: - raise + raise RuntimeError('Invalid response: ' + ret) except Exception as error: TEST_FAILED("A2DP Source: " + str(error)) -- GitLab