Version
main
Platform
Subsystem
stream
What steps will reproduce the bug?
import { push } from 'node:stream/iter';
const { readable } = push();
const iterator = readable[Symbol.asyncIterator]();
const error = new Error('boom');
try {
const result = await iterator.throw(error);
console.log('resolved:', result);
} catch (err) {
console.log('rejected:', err.message);
}
How often does it reproduce? Is there a required condition?
Always
What is the expected behavior? Why is that the expected behavior?
The spec says Stream.push() creates a readable whose composed pipeline is aborted “on return or throw (consumer stops iterating)” and cancellation is signaled to the writer. Since this is the iterator throw() path, the provided error should be propagated by rejecting with that error, not converted into a successful completion.
Spec §7.1, step 11
On return or throw (consumer stops iterating), abort pipelineController and signal cancellation to writer.
What do you see instead?
resolved: [Object: null prototype] { done: true, value: undefined }
Additional information
No response
Version
main
Platform
Subsystem
stream
What steps will reproduce the bug?
How often does it reproduce? Is there a required condition?
Always
What is the expected behavior? Why is that the expected behavior?
rejected: boomThe spec says
Stream.push()creates a readable whose composed pipeline is aborted “on return or throw (consumer stops iterating)” and cancellation is signaled to the writer. Since this is the iteratorthrow()path, the provided error should be propagated by rejecting with that error, not converted into a successful completion.Spec §7.1, step 11
What do you see instead?
resolved: [Object: null prototype] { done: true, value: undefined }Additional information
No response