Skip to content

Commit 04a71e0

Browse files
committed
Infos
1 parent 566b4d5 commit 04a71e0

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

index.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -457,6 +457,7 @@ class TuyaDevice extends EventEmitter {
457457
'Timeout waiting for status response from device id: ' + this.device.id
458458
);
459459
// This case returns an undefined when set-for-get is used!
460+
// Alternative would be to throw but this would be breaking.
460461
}));
461462
}
462463

@@ -568,13 +569,19 @@ class TuyaDevice extends EventEmitter {
568569
// Automatically ask for dp_refresh so we
569570
// can emit a `dp_refresh` event as soon as possible
570571
if (this.globalOptions.issueRefreshOnConnect) {
571-
this.refresh();
572+
this.refresh().catch(error => {
573+
debug('Error refreshing on connect: ' + error);
574+
this.emit('error', error);
575+
});
572576
}
573577

574578
// Automatically ask for current state so we
575579
// can emit a `data` event as soon as possible
576580
if (this.globalOptions.issueGetOnConnect) {
577-
this.get();
581+
this.get().catch(error => {
582+
debug('Error getting on connect: ' + error)
583+
this.emit('error', error);
584+
});
578585
}
579586

580587
// Resolve

0 commit comments

Comments
 (0)