Skip to content

Commit

Permalink
add find timeout and catch error
Browse files Browse the repository at this point in the history
  • Loading branch information
apexad committed Nov 26, 2020
1 parent 10a7199 commit c909521
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ export class RoboVac {
console.log('Connecting...');
}
await this.api.connect();

}
}

Expand All @@ -150,9 +149,13 @@ export class RoboVac {
if (this.debugLog) {
console.log('Looking for device...');
}
await this.api.find();
if (this.debugLog) {
console.log(`Found device ${this.api.device.id} at ${this.api.device.ip}`);
try {
await this.api.find({ timeout: 2 });
if (this.debugLog) {
console.log(`Found device ${this.api.device.id} at ${this.api.device.ip}`);
}
} catch(err) {
console.log(err);
}
}
await this.connect();
Expand Down

0 comments on commit c909521

Please sign in to comment.