File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
Expand file tree Collapse file tree 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 {
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
You can’t perform that action at this time.
0 commit comments