File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -33,8 +33,9 @@ function Controller(settings) {
3333 parser : SerialPort . parsers . readline ( '\n' )
3434 } ) ;
3535
36- self . port . on ( 'open' , self . _onPortOpen . bind ( self ) ) ;
37- self . port . on ( 'data' , self . _onPortData . bind ( self ) ) ;
36+ self . port . on ( 'open' , self . _onPortOpen . bind ( self ) ) ;
37+ self . port . on ( 'error' , self . _onPortError . bind ( self ) ) ;
38+ self . port . on ( 'data' , self . _onPortData . bind ( self ) ) ;
3839
3940 self . _isFirstLine = true ;
4041
@@ -216,6 +217,20 @@ Controller.prototype._onPortOpen = function() {
216217 } ) ;
217218} ;
218219
220+ Controller . prototype . _onPortError = function ( err ) {
221+ var self = this ;
222+
223+ console . error (
224+ 'Serial port error: %s' ,
225+ err . message
226+ ) ;
227+ console . error (
228+ 'Check the serial device name and make sure it\'s connected.'
229+ ) ;
230+ console . error ( ) ;
231+ throw err ;
232+ } ;
233+
219234Controller . prototype . _onPortData = function ( line ) {
220235 var self = this ;
221236
You can’t perform that action at this time.
0 commit comments