duplexer2 icon indicating copy to clipboard operation
duplexer2 copied to clipboard

With more than 2 pipeline stages, errors from middle stages are not bubbled.

Open dimfeld opened this issue 9 years ago • 0 comments

I'm not sure if there's anything you can reasonably do about this without getting even deeper into the stream internals, but a documentation update would be great so future people don't fall into this trap. I ran into this on Node 5.6.0. Here's a simple workaround:

var output = input.pipe(otherStage).pipe(outputStage);
var d = duplexer(input, output);
// This next line is necessary, or else exceptions from otherStage get lost.
otherStage.on('error', function(e) { d.emit('error', e); });

EDIT: To clarify, what I see is that Node does detect the error, but it quits without any sort of message so it's difficult to find the cause of the process ending unexpectedly.

dimfeld avatar Feb 12 '16 20:02 dimfeld