remove use of deprecated DomException code property

This commit is contained in:
David Lechner
2022-10-14 16:21:18 -05:00
committed by David Lechner
parent eb26bfcf1b
commit db43cb3e99
3 changed files with 9 additions and 30 deletions
+2 -2
View File
@@ -75,7 +75,7 @@ function* handleConnect(): Generator {
}),
);
} catch (err) {
if (err instanceof DOMException && err.code === DOMException.NOT_FOUND_ERR) {
if (err instanceof DOMException && err.name === 'NotFoundError') {
// this can happen if the use cancels the dialog
yield* put(didFailToConnect(Reason.Canceled));
} else {
@@ -119,7 +119,7 @@ function* handleConnect(): Generator {
} catch (err) {
server.disconnect();
yield* takeMaybe(disconnectChannel);
if (err instanceof DOMException && err.code === DOMException.NOT_FOUND_ERR) {
if (err instanceof DOMException && err.name === 'NotFoundError') {
yield* put(didFailToConnect(Reason.GattServiceNotFound));
} else {
yield* put(didFailToConnect(Reason.Unknown, ensureError(err)));