Re: [whatwg/streams] Should writer.write() reject with the stored error when the writable stream is errored? (#700)

Hmm ... I don't remember why I made it to do so.

In short, I think it's ok to fix it to reject with `[[storedError]]`.

I remember that somewhere I insisted that a stream should throw (reject with) an exception that indicates that the program is doing something just wrong than the stored exception when e.g. a stream is written to after requested to close.

A writable stream may be errored by either
- (1) `controller.error()` by the sink
- (2) `writer.abort()` by the user

The rationale applies to (2), but not for (1). I agree that we should use `[[storedError]]` for (1).

Regarding (2), I think we had some discussion and one option was to have a writable stream remember that it has been aborted. The idea behind my opinion was that it's weird if a user receives the error he/she passed to `writer.abort()` echo-ed back. IIRC, we chose not to have a dedicated state indicating that but have `WritableStreamFinishAbort()` set `[[storedError]]` to an exception indicating the stream has been aborted. So, `[[storedError]]` would hold an error telling the user that he/she's doing something wrong. So, using `[[storedError]]` is still fine for (2).


-- 
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/issues/700#issuecomment-288663735

Received on Thursday, 23 March 2017 09:33:22 UTC