Re: [whatwg/dom] Add a way to identify Abort errors originating from controllers (Issue #1033)

@kanongil 
> Also, is it really an issue? If someone does controller.abort(1), they will most likely catch any errors themselves, and handle it however they want.

Apparently, when I went around asking library authors and project members identifying AbortErrors _was_ important to them so I am here representing them figuring out if we can do this.

@annevk 
> The design doesn't allow for that. At least, it's not clear to me how you'd do that for controller.abort(1) or equivalent.

I would have honestly much preferred if it was only possible to abort with `error`s (or even just `DOMException`s) - but if it isn't possible to make that happen - then I would be content with a way to solve [this case](https://github.com/whatwg/dom/issues/1033#issuecomment-974821611) _just_ for errors.

Something like:
```js
// Detect if an error was signaled as a cancellation reason
// throws TypeError if `err` isn't an Error (or DOMException, but preferably error)
// returns true if the error was tagged as signaling cancellation, false otherwise
AbortController.isAbort(err); 
```

I realize this can be done in Node.js land as a static method - but I don't think this is a Node.js specific concern.

-- 
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-979960959

Received on Friday, 26 November 2021 12:59:45 UTC