Re: [whatwg/dom] Adding a return value to `controller.abort()` which represents abort completion (#881)

Well, I want failures to be bubbled using a simple `await controller.abort()`, like in the OP. If we had `allSettled` semantics I'd have to do something like

```js
const results = await controller.abort();
if (results.some(r => r.state === "rejected")) {
  throw new Error("Failure during aborting: " + r.reason.message);
}
```

to get that back. So that would really hurt the single-fetch use case.

I do agree that `allSettled` is probably more theoretically "correct", in that it communicates all the potentially-relevant information. But in terms of the use I envision, where this is a way to conveniently rethrow any errors that prevented normal aborting, `all` semantics are more helpful.

Relatedly, we probably would want to mark the returned promise as handled, so that consumers which _don't_ want to rethrow such errors don't get bothered by unhandled rejection warnings. That fits with how this is a supplementary failure channel that just makes it easier to extract failure information that you could get via other means, e.g. by saving the promise returned by `fetch()` or `pipeTo()`.

-- 
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/dom/issues/881#issuecomment-675002130

Received on Monday, 17 August 2020 17:11:31 UTC