Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/internal/streams/pipeline.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ function pipelineImpl(streams, callback, opts) {
}

function finishImpl(err, final) {
if (err && (!error || error.code === 'ERR_STREAM_PREMATURE_CLOSE')) {
if (err && (!error || error.code === 'ERR_STREAM_PREMATURE_CLOSE' || error.name === 'AbortError')) {
error = err;
}

Expand Down
21 changes: 21 additions & 0 deletions test/parallel/test-stream-pipeline.js
Original file line number Diff line number Diff line change
Expand Up @@ -1749,3 +1749,24 @@ tmpdir.refresh();
assert.deepStrictEqual(err, new Error('booom'));
}));
}

{
// Errors thrown in Readable.map inside pipeline should not be
// swallowed by AbortError when the source is an infinite stream.
pipeline(
new Readable({ read() { this.push('data'); } }),
new Transform({
readableObjectMode: true,
transform(chunk, encoding, callback) {
this.push({});
callback();
},
}),
(readable) => readable.map(async () => {
throw new Error('Boom!');
}),
common.mustCall((err) => {
assert.strictEqual(err.message, 'Boom!');
}),
);
}
Loading