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.

remove this line

-- 
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#pullrequestreview-29384580

Received on Tuesday, 28 March 2017 08:22:21 UTC