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 push signal abort reason · nodejs/node@2632d60

File tree

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

‎lib/internal/streams/iter/push.js‎

Copy file name to clipboardExpand all lines: lib/internal/streams/iter/push.js
+2-4Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const {
2525
ERR_INVALID_STATE,
2626
},
2727
} = require('internal/errors');
28-
const { isError, lazyDOMException } = require('internal/util');
28+
const { lazyDOMException } = require('internal/util');
2929
const {
3030
validateAbortSignal,
3131
validateInteger,
@@ -135,9 +135,7 @@ class PushQueue {
135135

136136
if (this.#signal) {
137137
this.#abortHandler = () => {
138-
this.fail(isError(this.#signal.reason) ?
139-
this.#signal.reason :
140-
lazyDOMException('Aborted', 'AbortError'));
138+
this.fail(this.#signal.reason);
141139
};
142140
onSignalAbort(this.#signal, this.#abortHandler);
143141
}
Collapse file

‎test/parallel/test-stream-iter-push-basic.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-stream-iter-push-basic.js
+11Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,16 @@ async function testAbortSignal() {
107107
);
108108
}
109109

110+
async function testAbortSignalReason() {
111+
const reason = 'test reason';
112+
const ac = new AbortController();
113+
const { writer } = push({ signal: ac.signal });
114+
115+
ac.abort(reason);
116+
117+
await assert.rejects(writer.write('data'), (err) => err === reason);
118+
}
119+
110120
async function testPreAbortedSignal() {
111121
const { readable } = push({ signal: AbortSignal.abort() });
112122
await assert.rejects(async () => {
@@ -172,6 +182,7 @@ Promise.all([
172182
testWriterFail(),
173183
testConsumerBreak(),
174184
testAbortSignal(),
185+
testAbortSignalReason(),
175186
testPreAbortedSignal(),
176187
testConsumerBreakWriteSyncReturnsFalse(),
177188
testPushWithTransforms(),

0 commit comments

Comments
0 (0)
You are visitor 01402503 — 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.