bthrm - More logging for errors

master
Martin Boonk 2022-11-16 17:31:19 +01:00
parent 727f1ac504
commit a484e0379c
1 changed files with 6 additions and 2 deletions

View File

@ -460,7 +460,7 @@ exports.enable = () => {
} else { } else {
log("Start bonding"); log("Start bonding");
return gatt.startBonding() return gatt.startBonding()
.then(() => console.log(gatt.getSecurityStatus())); .then(() => log("Security status" + gatt.getSecurityStatus()));
} }
}); });
} }
@ -644,7 +644,11 @@ exports.enable = () => {
E.on("kill", ()=>{ E.on("kill", ()=>{
if (gatt && gatt.connected){ if (gatt && gatt.connected){
log("Got killed, trying to disconnect"); log("Got killed, trying to disconnect");
gatt.disconnect().then(()=>log("Disconnected on kill")).catch((e)=>log("Error during disconnnect on kill", e)); try {
gatt.disconnect().then(()=>log("Disconnected on kill")).catch((e)=>log("Error during disconnnect promise on kill", e));
} catch (e) {
log("Error during disconnnect on kill", e)
}
} }
}); });
} }