- From: Gil Pedersen <notifications@github.com>
- Date: Sun, 21 Nov 2021 03:44:54 -0800
- To: whatwg/dom <dom@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Sunday, 21 November 2021 11:45:07 UTC
Won't it always be safer to check `signal.aborted` / `signal.reason` when handling rejection errors? Even if you brand the errors, it could have originated from a different signal.
```js
async function a({ signal }) {
await b();
}
async function b() {
const ab = new AbortController();
ab.abort();
throw ab.signal.reason;
}
try {
const ab = new AbortController();
await a({ signal: ab.signal });
}
catch (err) {
console.log(err); // 'AbortError' DOMException
console.log(ab.signal.aborted); // false
}
```
--
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/1033#issuecomment-974801046
Received on Sunday, 21 November 2021 11:45:07 UTC