File tree 1 file changed +17
-2
lines changed
1 file changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -33,8 +33,9 @@ function Controller(settings) {
33
33
parser : SerialPort . parsers . readline ( '\n' )
34
34
} ) ;
35
35
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 ) ) ;
38
39
39
40
self . _isFirstLine = true ;
40
41
@@ -216,6 +217,20 @@ Controller.prototype._onPortOpen = function() {
216
217
} ) ;
217
218
} ;
218
219
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
+
219
234
Controller . prototype . _onPortData = function ( line ) {
220
235
var self = this ;
221
236
You can’t perform that action at this time.
0 commit comments