-
Notifications
You must be signed in to change notification settings - Fork 29.9k
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 <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Jeremiah Senkpiel <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
Errors should be propagated through destroy(err). Anything else is basically undefined behaviour. PR-URL: #29653 Refs: #29584 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Jeremiah Senkpiel <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
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: