File tree Expand file tree Collapse file tree 1 file changed +14
-10
lines changed Expand file tree Collapse file tree 1 file changed +14
-10
lines changed Original file line number Diff line number Diff line change @@ -76,20 +76,24 @@ function onConnect() {
7676}
7777
7878function onMessage ( topic , message , packet ) {
79- var dest = topic ,
80- oldStatus = this . _status ;
79+ try {
80+ var dest = topic ,
81+ oldStatus = this . _status ;
8182
82- switch ( dest . substr ( dest . lastIndexOf ( '/' ) + 1 ) ) {
83+ switch ( dest . substr ( dest . lastIndexOf ( '/' ) + 1 ) ) {
8384
84- case 'STATUS' :
85- this . _status = message . toString ( ) ;
86- detectStatusChange ( this , this . _status , oldStatus ) ;
87- break ;
85+ case 'STATUS' :
86+ this . _status = message . toString ( ) ;
87+ detectStatusChange ( this , this . _status , oldStatus ) ;
88+ break ;
8889
89- default :
90- ( this . _status === STATUS . OK ) && this . emit ( TransportEvent . MESSAGE , message ) ;
91- break ;
90+ default :
91+ ( this . _status === STATUS . OK ) && this . emit ( TransportEvent . MESSAGE , message ) ;
92+ break ;
9293
94+ }
95+ } catch ( err ) {
96+ this . emit ( TransportEvent . ERROR , err ) ;
9397 }
9498}
9599
You can’t perform that action at this time.
0 commit comments