- From: Domenic Denicola <notifications@github.com>
- Date: Fri, 22 Sep 2017 10:44:17 +0000 (UTC)
- To: whatwg/streams <streams@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <whatwg/streams/pull/800/review/64542060@github.com>
domenic commented on this pull request. I think some further simplifications are possible; let me know if you agree. It sounds like tests don't change because it's a TypeError either way, right? > @@ -277,7 +240,11 @@ class TransformStreamDefaultController { throw defaultControllerBrandCheckException('error'); } - TransformStreamError(this._controlledTransformStream, reason); + if (this._controlledTransformStream._readable._state !== 'readable') { + throw new TypeError('TransformStream is not in a state that can be errored'); + } + + TransformStreamDefaultControllerError(this, reason); Since TransformStreamDefaultControllerError is so short, can we just inline it here? > @@ -150,28 +131,10 @@ function TransformStreamEnqueueToReadable(transformStream, chunk) { } } -function TransformStreamError(transformStream, e) { - if (transformStream._errored === true) { - throw new TypeError('TransformStream is already errored'); - } - - TransformStreamErrorInternal(transformStream, e); -} - -function TransformStreamErrorIfNeeded(transformStream, e) { - if (transformStream._errored === false) { - TransformStreamErrorInternal(transformStream, e); - } -} - +// This is a no-op if both sides are already errored. function TransformStreamErrorInternal(transformStream, e) { This should probably lose the -Internal suffix now? -- 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/800#pullrequestreview-64542060
Received on Friday, 22 September 2017 10:44:39 UTC