GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — stream: preserve error over AbortError in pipeline · nodejs/node@03839fb

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • lib/internal/streams
    • pipeline.js
  • test/parallel
    • test-stream-pipeline.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎lib/internal/streams/pipeline.js‎

Copy file name to clipboardExpand all lines: lib/internal/streams/pipeline.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ function pipelineImpl(streams, callback, opts) {
227227
}
228228

229229
function finishImpl(err, final) {
230-
if (err && (!error || error.code === 'ERR_STREAM_PREMATURE_CLOSE')) {
230+
if (err && (!error || error.code === 'ERR_STREAM_PREMATURE_CLOSE' || error.name === 'AbortError')) {
231231
error = err;
232232
}
233233

Collapse file

‎test/parallel/test-stream-pipeline.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-stream-pipeline.js
+21Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1749,3 +1749,24 @@ tmpdir.refresh();
17491749
assert.deepStrictEqual(err, new Error('booom'));
17501750
}));
17511751
}
1752+
1753+
{
1754+
// Errors thrown in Readable.map inside pipeline should not be
1755+
// swallowed by AbortError when the source is an infinite stream.
1756+
pipeline(
1757+
new Readable({ read() { this.push('data'); } }),
1758+
new Transform({
1759+
readableObjectMode: true,
1760+
transform(chunk, encoding, callback) {
1761+
this.push({});
1762+
callback();
1763+
},
1764+
}),
1765+
(readable) => readable.map(async () => {
1766+
throw new Error('Boom!');
1767+
}),
1768+
common.mustCall((err) => {
1769+
assert.strictEqual(err.message, 'Boom!');
1770+
}),
1771+
);
1772+
}

0 commit comments

Comments
0 (0)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.