From 21208344be3becc4325f6d108cff49f0b53dd1f7 Mon Sep 17 00:00:00 2001 From: David Lechner Date: Fri, 22 May 2020 13:31:27 -0500 Subject: [PATCH] Add error notification for service error On Linux/BlueZ, sometimes the services are not enumerated properly and the user has to remove the Bluetooth device from BlueZ, then it should work correctly. --- src/services/bootloader.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/services/bootloader.ts b/src/services/bootloader.ts index 6585a38e..2889a628 100644 --- a/src/services/bootloader.ts +++ b/src/services/bootloader.ts @@ -95,6 +95,17 @@ async function connect(action: Action, dispatch: Dispatch): Promise { ); } } catch (err) { + if ( + err instanceof DOMException && + err.code === DOMException.NOT_FOUND_ERR + ) { + dispatch( + notification.add( + 'error', + 'Connected to hub but failed to get LEGO bootloader service. Try removing the "LEGO Bootloader" device in your OS Bluetooth settings, then try again.', + ), + ); + } device.gatt.disconnect(); throw err; }