show error message if failed to connect to device

This commit is contained in:
liamcottle
2025-02-13 14:37:19 +13:00
parent 474cbf31d9
commit deb7cb9374

View File

@@ -10,8 +10,19 @@ class Connection {
await this.connect(await BleConnection.open());
return true;
} catch(e) {
console.log(e);
// ignore device not selected error
if(e.name === "NotFoundError"){
return false;
}
// show error message
alert("failed to connect to ble device!");
return false;
}
}
@@ -20,8 +31,19 @@ class Connection {
await this.connect(await SerialConnection.open());
return true;
} catch(e) {
console.log(e);
// ignore device not selected error
if(e.name === "NotFoundError"){
return false;
}
// show error message
alert("failed to connect to serial device!");
return false;
}
}