- From: isonmad <notifications@github.com>
- Date: Tue, 20 Sep 2016 16:07:02 -0700
- To: whatwg/streams <streams@noreply.github.com>
- Message-ID: <whatwg/streams/pull/519/review/858301@github.com>
isonmad commented on this pull request.
> - } else {
- try {
- transformStream._transformer.flush(
- transformStream._enqueueFunction,
- transformStream._closeFunction,
- transformStream._errorFunction);
- } catch (e) {
- if (transformStream._errored === false) {
- TransformStreamErrorInternal(transformStream, e);
- throw e;
- }
- }
- }
+ const flushPromise = PromiseInvokeOrNoop(transformStream._transformer, 'flush', [transformStream._controller]);
+ // Return a promise that is fulfilled with undefined on success.
+ return flushPromise.then(() => TransformStreamCloseReadableInternal(transformStream),
You're right, that should be fixed, though I'm tempted to make `controller.error()` throw after `flush()` is called, like with `controller.close()`.
Otherwise, what should happen if controller.error() is called with one error, and flush throws or rejects the promise with a different error? What should happen if controller.close() is called, but then the flushPromise is rejected? It seemed simpler to give flush only a single way of signaling success or failure.
--
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/519
Received on Tuesday, 20 September 2016 23:07:33 UTC