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) {
141141
142142 } ) . catch ( recognizeStream . emit . bind ( recognizeStream , 'error' ) ) ;
143143
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 ) ;
144155
145156 return stream ;
146157} ;
Original file line number Diff line number Diff line change @@ -404,7 +404,7 @@ RecognizeStream.prototype.finish = function finish() {
404404 this . finished = true ;
405405 var self = this ;
406406 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 ) {
408408 self . sendJSON ( closingMessage ) ;
409409 } else {
410410 this . once ( 'connect' , function ( ) {
You can’t perform that action at this time.
0 commit comments