-
-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Why duplexer2 calling with bubbleErrors equal false? #47
Comments
In this line we should make sure that any stream that isn't the returned stream (which in this case none is) will forward its errors to the returned stream: Line 62 in 50ca690
EDIT: we're specifically disabling This seems to be an issue with JSONStream, see dominictarr/JSONStream#136 I modified your script to not use JSONStream but a regular stream that emits an error event, and that is properly caught by multipipe: var {PassThrough} = require('stream')
var multipipe = require('multipipe'); // 1.0.2 version
var through2 = require('through2');
var https = require('https');
writableStream = through2(function(data, enc, callback) {
callback(null, data);
});
https.get('https://github.com/juliangruber/multipipe/blob/master/Readme.md', function(res) {
res.pipe(writableStream);
});
var readableStream = new PassThrough()
setImmediate(() => readableStream.emit('error', new Error('bloob')))
multipipe(
writableStream,
readableStream
).on('error', function(err) {
// it not works
console.log('Multipipe ERROR: ', err)
}); |
JSONStream throws error ok, the problem is in duplexer2. If read stream doesn't implement if (typeof readable.read !== "function") {
readable = (new stream.Readable(options)).wrap(readable);
} and in wrap function listeners on all event are applied: // proxy certain important events.
for (var n = 0; n < kProxyEvents.length; n++) {
stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n]));
} But, if Right now don't know how to fix it, other then to pass |
I've encountered same issue. |
I'll take another look! |
thanks, will be waiting for your news |
default { bubbleErrors: true }. closes #47
Thanks |
awesome, thanks |
Hey.
Error handling does not work how it written in the documentation. If the first stream writable and last stream readable, they wrap in duplexer2 with "bubbleErrors" option equal false (by default).
Multipipe will not emit error, in this example:
Why is this done?
The text was updated successfully, but these errors were encountered: