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.
This commit is contained in:
David Lechner
2020-05-22 19:54:48 -05:00
committed by David Lechner
parent 416c5b16e2
commit 21208344be
+11
View File
@@ -95,6 +95,17 @@ async function connect(action: Action, dispatch: Dispatch): Promise<void> {
);
}
} 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;
}