My question concerns error handling of a reader from a ReadableStreamDefaultReader
. I'm guessing that a Promise rejection from reader.read()
would usually indicate a network failure for a fetch request (in which case i'm guessing that it is NOT safe to continue reading and I should just stop using that reader entirely), but perhaps there are other possible errors in which it IS safe to continue reading?
So in what scenarios can I continue reading after I receive a Promise rejection from reader.read()
and in what scenarios should i scrap the reader entirely? Do I need to introspect on the type of error in order to make a decision?
A stream cannot recover from an error. If it is errored, reading from it will always return a rejected promise.