- From: James Browning <notifications@github.com>
- Date: Sat, 06 Feb 2021 17:55:18 -0800
- To: whatwg/dom <dom@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Sunday, 7 February 2021 01:55:30 UTC
> Basically it's up to userland to create a `class AbortError extends Error { code = 'ABORT_ERR' }`.
This is different to browsers, `abortError.code` is just a number in `DOMException`. Currently I've been using `.name === "AbortError"`, however this is somewhat fragile against userland classes as they might forget to add `name = "AbortError";` into the class.
This is one reason I think it'd strongly be best if there was a global exposed in both Node and Browsers that could construct a "blessed" `AbortError` so that people can reliably both construct them and check if a given error is an `AbortError` without relying on userland to correctly implement many copies of `AbortError`. (Or something like the alternative I described above where `abortController.abort()` constructs one).
--
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/927#issuecomment-774575239
Received on Sunday, 7 February 2021 01:55:30 UTC