[whatwg/streams] Internal promises that can be rejected need to be handled (#468)

Title is a general rule of thumb but there's only one violation that I've found so far, and its in the reference implementation of pipeTo. The promises returned from dest.write are not catch'd and are never exposed to any consumers for them to catch either. So if there's an error with dest and there are pending writes from a pipe there will be uncaught Javascript exceptions and nothing the consumer can reasonably do to handle them. Possible solution is to pass a blank function to a catch of write, or rethrowAssertionErrorRejection.

There's also an issue with consumers/producers having to handle the exceptions from read()/write() and also the closed promise. They must handle both even though they'll be the same error. pipeTo is an example of this where any [non-assertion] errors from read() are just swallowed because they're handled in close. I'm not sure if this can be cleaned up, I can see some consumers wanting the closed promise and others wanting the promises from read/write, but I figured I'd point out the forced redundancy anyways.

---
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/issues/468

Received on Tuesday, 21 June 2016 18:24:25 UTC