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

domenic commented on this pull request.



> -    if (writer !== undefined) {
-      if (WritableStreamCloseQueuedOrInFlight(stream) === false && stream._backpressure === true) {
-        defaultWriterReadyPromiseReject(writer, reason);
-      } else {
-        defaultWriterReadyPromiseResetToRejected(writer, reason);
-      }
-      writer._readyPromise.catch(() => {});
-    }
-  } else {
-    stream._pendingAbortRequest._reject(reason);
-    stream._pendingAbortRequest = undefined;
-  }
-
-  WritableStreamRejectPromisesInReactionToError(stream);
+  WritableStreamError(stream, error);
+  WritableStreamRejectAbortRequestIfPending(stream);

Ah, it is not that easy, because WritableStreamRejectAbortRequestIfPending assumes the stream is already in the errored state. So I think it is an OK change. It would be slightly nicer for close to always be last but it still seems OK.

-- 
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_r108362488

Received on Tuesday, 28 March 2017 08:33:30 UTC