-
Notifications
You must be signed in to change notification settings - Fork 29.7k
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
Dealing with async errors during _read()
#29584
Comments
I ran into these kinds of issues for Fishrock123/bob#35 as well.
I find it quite odd that |
_read()
@Fishrock123 I went with this #29653. Works well as long as |
Errors should be propagated through destroy(err). Anything else is basically undefined behaviour. PR-URL: #29653 Refs: #29584 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Errors should be propagated through destroy(err). Anything else is basically undefined behaviour. PR-URL: #29653 Refs: #29584 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
We want people to use |
I feel like there is something missing in the streams
_read
API for implementors.Basically the current state of things is that stream implementors need to implement async error handling something like this:
There are some problems with this:
autoDestroy
option and eitherdestroy()
oremit('error', err)
, which one they choose is mostly unclear and undocumented._readableState
object or add a flag based on the options sent to theReadable
super.I'm not quite sure how to resolve this. I can think of a few ways:
cb
to_read
that can be invoked with an error and would internally call theerrorOrDestroy
method.errorOrDestroy
util directly accessible for stream implementors and document it somehow._readableState
).autoDestroy
and make ittrue
by default.autoDestroy
is for stream implementors only and not for stream consumers.The text was updated successfully, but these errors were encountered: