File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -141,6 +141,17 @@ module.exports = function recognizeMicrophone(options) {
141
141
142
142
} ) . catch ( recognizeStream . emit . bind ( recognizeStream , 'error' ) ) ;
143
143
144
+ /**
145
+ * Propagate error to new FormatStream
146
+ *
147
+ * @param {String } error message
148
+ */
149
+ function handleError ( error ) {
150
+ stream . emit ( 'error' , error ) ;
151
+ }
152
+
153
+ // Capture error from original RecognizeStream
154
+ recognizeStream . on ( 'error' , handleError ) ;
144
155
145
156
return stream ;
146
157
} ;
Original file line number Diff line number Diff line change @@ -404,7 +404,7 @@ RecognizeStream.prototype.finish = function finish() {
404
404
this . finished = true ;
405
405
var self = this ;
406
406
var closingMessage = { action : 'stop' } ;
407
- if ( self . socket && self . socket . readyState !== self . socket . CLOSED && self . socket . readyState !== self . socket . CLOSING ) {
407
+ if ( self . socket && self . socket . readyState === self . socket . OPEN ) {
408
408
self . sendJSON ( closingMessage ) ;
409
409
} else {
410
410
this . once ( 'connect' , function ( ) {
You can’t perform that action at this time.
0 commit comments