Skip to content

Commit

Permalink
fixing error looping bug
Browse files Browse the repository at this point in the history
  • Loading branch information
nfriedly committed Nov 1, 2016
1 parent cd9432b commit 74aa663
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 34 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog

### v0.20.4
* Fix looping error propagation when not using FormatStream in recognizeMicrophone

### v0.20.3
* Fixed broken model query param in STT RecognizeStream

Expand Down
38 changes: 14 additions & 24 deletions dist/watson-speech.js

Large diffs are not rendered by default.

13 changes: 3 additions & 10 deletions speech-to-text/recognize-microphone.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,17 +141,10 @@ module.exports = function recognizeMicrophone(options) {

}).catch(recognizeStream.emit.bind(recognizeStream, 'error'));

/**
* Propagate error to new FormatStream
*
* @param {String} error message
*/
function handleError(error) {
stream.emit('error', error);
}

// Capture error from original RecognizeStream
recognizeStream.on('error', handleError);
if (stream !== recognizeStream) {
recognizeStream.on('error', stream.emit.bind(stream, 'error'));
}

return stream;
};
Expand Down

0 comments on commit 74aa663

Please sign in to comment.