Re: [whatwg/streams] Refactor writable stream erroring to be centralized (#705)

tyoshino commented on this pull request.



>    1. Let _promise_ be <a>a new promise</a>.
   1. Set _stream_.[[pendingAbortRequest]] to Record {[[promise]]: _promise_, [[reason]]: _reason_}.
   1. Return _promise_.
 </emu-alg>
 
+<h4 id="writable-stream-error" aoid="WritableStreamError" nothrow>WritableStreamError ( <var>stream</var>,
+<var>error</var> )</h4>
+
+<emu-alg>
+  1. Set _stream_.[[state]] to `"errored"`.
+  1. Set _stream_.[[storedError]] to _error_.
+  1. Perform ! _stream_.[[writableStreamController]].[[ErrorSteps]]().
+  1. If _stream_.[[pendingAbortRequest]] is *undefined*,
+    1. Let _writer_ be _stream_.[[writer]].
+    1. If _writer_ is not *undefined*,
+      1. Perform ! WritableStreamDefaultWriterEnsureReadyPromiseRejected(_writer_, _error_).
+  1. If ! WritableStreamHasOperationMarkedInFlight(_stream_) is *false*, perform !
+     WritableStreamRejectPromisesInReactionToError(_stream_).
+</emu-alg>
+
 <h4 id="writable-stream-finish-abort" aoid="WritableStreamFinishAbort" nothrow>WritableStreamFinishAbort (
 <var>stream</var> )</h4>
 
 <emu-alg>
   1. Let _error_ be a new *TypeError* indicating that the stream has been aborted.

oh, no. L2834 in the new snapshot should be updated instead.

-- 
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/705#discussion_r108360402

Received on Tuesday, 28 March 2017 08:23:10 UTC