gracefully handle failed to connect

This commit is contained in:
liamcottle
2025-02-13 14:32:50 +13:00
parent f4af191050
commit fa7a1af62b

View File

@@ -6,11 +6,23 @@ import Utils from "./Utils.js";
class Connection {
static async connectViaBluetooth() {
try {
await this.connect(await BleConnection.open());
return true;
} catch(e) {
console.log(e);
return false;
}
}
static async connectViaSerial() {
try {
await this.connect(await SerialConnection.open());
return true;
} catch(e) {
console.log(e);
return false;
}
}
static async connect(connection) {