Skip to content

Commit 74aa663

Browse files
committed
fixing error looping bug
1 parent cd9432b commit 74aa663

File tree

3 files changed

+20
-34
lines changed

3 files changed

+20
-34
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Changelog
22

3+
### v0.20.4
4+
* Fix looping error propagation when not using FormatStream in recognizeMicrophone
5+
36
### v0.20.3
47
* Fixed broken model query param in STT RecognizeStream
58

dist/watson-speech.js

Lines changed: 14 additions & 24 deletions
Large diffs are not rendered by default.

speech-to-text/recognize-microphone.js

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -141,17 +141,10 @@ 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-
153144
// Capture error from original RecognizeStream
154-
recognizeStream.on('error', handleError);
145+
if (stream !== recognizeStream) {
146+
recognizeStream.on('error', stream.emit.bind(stream, 'error'));
147+
}
155148

156149
return stream;
157150
};

0 commit comments

Comments
 (0)