On this page

    C

    DOMException

    History
    class DOMException extends errors.Error

    The Web IDL DOMException class. These errors are thrown by web-platform APIs in Node.js such as fetch(), AbortController, AbortSignal, and Web Streams. For details, see also Class: DOMException on the Globals page.

    The domException.name property identifies the type of the exception (for example, 'AbortError'). Unlike most errors in Node.js, the domException.code property is a number that corresponds to a legacy error code name (for example, 20 for ABORT_ERR).

    Node.js-specific APIs that support AbortSignal (such as events.once()) throw a Node.js AbortError (a native errors.Error with name of 'AbortError' and code of 'ABORT_ERR') rather than a DOMException. To identify abort errors in either case, checking err?.name === 'AbortError' is sufficient.

    See also ABORT_ERR.