- From: Mattias Buelens <notifications@github.com>
- Date: Wed, 21 Aug 2019 15:41:34 -0700
- To: whatwg/streams <streams@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Wednesday, 21 August 2019 22:41:57 UTC
MattiasBuelens commented on this pull request. > function next(done) { if (done) { resolveLoop(); } else { - pipeStep().then(next, rejectLoop); + uponPromise(pipeStep(), next, rejectLoop); I'm not sure if `uponPromise()` makes this code more readable. I feel like `PerformPromiseThen(pipeStep(), next, rejectLoop)` is more obvious, but then we have to export the low-level `then()` helper again. 😕 This also adds an extra `.catch()` handler on every pipe step, since this is now equivalent to: ```javascript pipeStep().then(next, rejectLoop).catch(rethrowAssertionErrorRejection); ``` The `.catch()` is not necessary, since we already handle that [here](https://github.com/whatwg/streams/blob/1146228f0bcc1077f6a0c0eff2452b89332ee2ba/reference-implementation/lib/readable-stream.js#L469): ```javascript setPromiseIsHandledToTrue(pipeLoop()); ``` which is equivalent to: ```javascript pipeLoop().catch(rethrowAssertionErrorRejection); ``` Although you wouldn't want to create this extra promise in a real implementation, I think it's fine for a reference implementation. -- 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/1010#pullrequestreview-278111580
Received on Wednesday, 21 August 2019 22:41:57 UTC