mirror of
https://github.com/nodejs/node.git
synced 2026-11-27 17:52:27 -05:00
stream: preserve push signal abort reason
Pass the stream-wide signal reason directly to writer.fail() so valid non-Error abort reasons are not replaced with an AbortError. Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com> Assisted-by: codex:gpt-5.6-sol PR-URL: https://github.com/nodejs/node/pull/64798 Fixes: https://github.com/nodejs/node/issues/64797 Reviewed-By: Aviv Keller <me@aviv.sh>
This commit is contained in:
1 parent
63fbd59e64
commit
2632d606bb
2 files changed
+13
-4
No files matched your search
@@ -107,6 +107,16 @@ async function testAbortSignal() {
|
||||
);
|
||||
}
|
||||
|
||||
async function testAbortSignalReason() {
|
||||
const reason = 'test reason';
|
||||
const ac = new AbortController();
|
||||
const { writer } = push({ signal: ac.signal });
|
||||
|
||||
ac.abort(reason);
|
||||
|
||||
await assert.rejects(writer.write('data'), (err) => err === reason);
|
||||
}
|
||||
|
||||
async function testPreAbortedSignal() {
|
||||
const { readable } = push({ signal: AbortSignal.abort() });
|
||||
await assert.rejects(async () => {
|
||||
@@ -172,6 +182,7 @@ Promise.all([
|
||||
testWriterFail(),
|
||||
testConsumerBreak(),
|
||||
testAbortSignal(),
|
||||
testAbortSignalReason(),
|
||||
testPreAbortedSignal(),
|
||||
testConsumerBreakWriteSyncReturnsFalse(),
|
||||
testPushWithTransforms(),
|
||||
|
||||
Reference in new issue
Block a user