Skip to content

Commit

Permalink
try to catch
Browse files Browse the repository at this point in the history
  • Loading branch information
steveredden committed Sep 29, 2021
1 parent 5817ee3 commit cfdcae2
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lib/iCloudSound.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ class iCloudSound {
this.deviceService.getCharacteristic(this.Characteristic.On)
.onSet(async (state) => {
this.debugLog(`Calling 'findiPhone(${this.config.username}, *redacted*, ${this.deviceName})`);
findiPhone(this.config.username, this.config.password, this.deviceName, function(err) {
if (err) {
this.log("Error with device " + this.deviceName);
this.debugLog(err)
}
});
try{
findiPhone(this.config.username, this.config.password, this.deviceName);
} catch(error) {
this.log("Error triggering " + this.deviceName);
this.debugLog(error)
}
setTimeout(() => {
this.deviceService.updateCharacteristic(this.Characteristic.On, false);
this.debugLog("Turning off stateless switch");
Expand Down

0 comments on commit cfdcae2

Please sign in to comment.