Re: [whatwg/streams] Make writer.abort() fail immediately (#715)

> Or is it similar to abort(), in that it's a request to error when in-flight stuff finishes?

I think this an important question.

My understanding of controller.error():
1. It is for out-of-band errors that aren't tied to the execution of a particular operation
2. It is generally expected to be called at times when no operations are executing
3. If it is called when an operation *is* executing, we may have a race condition or conflicting information.

I am leaning towards the idea that if controller.error() happens simultaneously with close() or with abort() pending, then it is the close() or abort() that "wins" and determines the eventual state of the stream.

I think I want controller.error() to behave exactly like abort() (but still not return a promise).

Implementation idea: add a flag which takes over the signalling function of [[pendingAbortRequest]]. The flag signals that abort() or controller.error() has been called. [[pendingAbortRequest]] would still be used as storage for the promise returned by abort(). Alternatively, an extra state "erroring" could be added.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/streams/pull/715#issuecomment-289998133

Received on Wednesday, 29 March 2017 06:43:35 UTC