Re: [whatwg/streams] Unified error handling for WritableStream (#721)

ricea commented on this pull request.



> -  WritableStreamRejectAbortRequestIfPending(stream);
-  WritableStreamRejectPromisesInReactionToError(stream);
+function WritableStreamFinishError(stream) {
+  assert(stream._state === 'erroring', 'stream._state === erroring');
+  assert(WritableStreamHasOperationMarkedInFlight(stream) === false,
+         'WritableStreamHasOperationMarkedInFlight(stream) === false');
+  stream._state = 'errored';
+  stream._writableStreamController[ErrorSteps]();
+
+  const storedError = stream._storedError;
+  for (const writeRequest of stream._writeRequests) {
+    writeRequest._reject(storedError);
+  }
+  stream._writeRequests = [];
+
+  if (stream._pendingAbortRequest === undefined) {

Good catch. It was indeed broken. I have fixed it. PTAL.

-- 
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/721#discussion_r110183706

Received on Thursday, 6 April 2017 14:56:54 UTC