File tree 1 file changed +9
-2
lines changed
1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -457,6 +457,7 @@ class TuyaDevice extends EventEmitter {
457
457
'Timeout waiting for status response from device id: ' + this . device . id
458
458
) ;
459
459
// This case returns an undefined when set-for-get is used!
460
+ // Alternative would be to throw but this would be breaking.
460
461
} ) ) ;
461
462
}
462
463
@@ -568,13 +569,19 @@ class TuyaDevice extends EventEmitter {
568
569
// Automatically ask for dp_refresh so we
569
570
// can emit a `dp_refresh` event as soon as possible
570
571
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
+ } ) ;
572
576
}
573
577
574
578
// Automatically ask for current state so we
575
579
// can emit a `data` event as soon as possible
576
580
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
+ } ) ;
578
585
}
579
586
580
587
// Resolve
You can’t perform that action at this time.
0 commit comments