Re: [whatwg/streams] Marking promise rejections as handled (#547)

> I think the same concern applies to the Promises returned by write() and close(), based on my reading of the tests.

Yes, this is true; I agree with your analysis. However, I think I disagree on the solution. IMO if you do something like calling close() or write() and an error occurs, it's OK to get an unhandled rejection. You'll get notified about the error, which is good. What's not good is for the getters, which are just updated to keep things in sync, to start telling you about errors. You did not call them.

So I would be OK with only fixing the getters, and not marking the promises returned by write() or close() as handled.

> I just realised that we can resolve this for getters by creating the Promise lazily when the getter is used.

That's really interesting. I guess the difference for authors would be that, given

```js
writer.closed.then(() => console.log("good!"));
```

if the stream is errored, then with lazy getters they will still get an unhandled rejection here, whereas with the proposed mark-as-handled, they will not.

This will be fairly invasive spec-wise :-/. But I guess it's probably the better solution, so we should do it.

-- 
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/547#issuecomment-255483823

Received on Friday, 21 October 2016 22:53:11 UTC