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

domenic commented on this pull request.



> @@ -12,6 +12,9 @@ const ErrorSteps = Symbol('[[ErrorSteps]]');
 class WritableStream {
   constructor(underlyingSink = {}, { size, highWaterMark = 1 } = {}) {
     this._state = 'writable';
+
+    // The error that will be reported by new method calls once the state becomes errored. Only set when [[state]] is
+    // 'errored' or [[pendingError]] is true. May be set to an undefined value.

Mentions "pendingError"

> @@ -42,6 +45,9 @@ class WritableStream {
     // The backpressure signal set by the controller.
     this._backpressure = false;
 
+    // True if an error is pending on the stream.
+    this._pendingError = false;

No longer necessary

>    return promise;
 }
 
-function WritableStreamError(stream, error) {
-  stream._state = 'errored';
-  stream._storedError = error;
+function WritableStreamSetPendingError(stream, reason) {

Maybe this should be renamed WritableStreamBecomeErroring or similar? Might be fine as-is.

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

Received on Friday, 31 March 2017 11:40:17 UTC