-
Notifications
You must be signed in to change notification settings - Fork 30.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
stream: Readable iterator unhandled error when piping #28194
Labels
stream
Issues and PRs related to the stream subsystem.
Comments
I don't know for sure, but does |
No, it doesn't unfortunately, because the error is passed to the async function print() {
const read = fs.createReadStream('file');
const stream = new PassThrough();
const iterator = pipeline(read, stream, (err) => {
// I get the error here
// print will resolve, without iterating.
});
for await (const k of iterator) {
console.log(k);
}
} |
marcosc90
added a commit
to marcosc90/node
that referenced
this issue
Dec 9, 2019
3 tasks
4 tasks
mcollina
added a commit
to mcollina/node
that referenced
this issue
Dec 12, 2019
This changes makes all stream in a pipeline emit 'error' in case of an abnormal termination of the pipeline. If the last stream is currently being async iterated, this change will make the iteration reject accordingly. See: nodejs#30861 Fixes: nodejs#28194
MylesBorins
pushed a commit
that referenced
this issue
Dec 17, 2019
This changes makes all stream in a pipeline emit 'error' in case of an abnormal termination of the pipeline. If the last stream is currently being async iterated, this change will make the iteration reject accordingly. See: #30861 Fixes: #28194 PR-URL: #30869 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
targos
pushed a commit
to targos/node
that referenced
this issue
Apr 25, 2020
This changes makes all stream in a pipeline emit 'error' in case of an abnormal termination of the pipeline. If the last stream is currently being async iterated, this change will make the iteration reject accordingly. See: nodejs#30861 Fixes: nodejs#28194 PR-URL: nodejs#30869 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
codebytere
pushed a commit
that referenced
this issue
Jun 6, 2020
This changes makes all stream in a pipeline emit 'error' in case of an abnormal termination of the pipeline. If the last stream is currently being async iterated, this change will make the iteration reject accordingly. See: #30861 Fixes: #28194 PR-URL: #30869 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
1 task
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When using
asyncIterator
on a piped stream, the error is not handled correctly.In the above example, the
.catch
is not catching the error, and the script crashes.I know, that I should catch the error of each stream, but if I do:
The
print
function never resolves nor rejects. The only solution I've found is to emit the error to the piped stream.When you have multiple pipes, this can get very ugly. I don't know if this is the intended behaviour, but makes it hard & ugly to work with async iterators.
The text was updated successfully, but these errors were encountered: