{"version":3,"file":"DOMException.js","sourceRoot":"","sources":["../../source/errors/DOMException.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,2FAA2F;AAC3F,MAAM,uBAAuB,GAAG,OAAO,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC;AAEjE,+IAA+I;AAC/I,MAAM,UAAU,iBAAiB,CAAC,MAAoB;IACrD;;;MAGE;IACF,IAAI,uBAAuB,EAAE;QAC5B,OAAO,IAAI,YAAY,CAAC,MAAM,EAAE,MAAM,IAAI,4BAA4B,EAAE,YAAY,CAAC,CAAC;KACtF;IAED,2EAA2E;IAC3E,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,MAAM,EAAE,MAAM,IAAI,4BAA4B,CAAC,CAAC;IACxE,KAAK,CAAC,IAAI,GAAG,YAAY,CAAC;IAE1B,OAAO,KAAK,CAAC;AACd,CAAC","sourcesContent":["// DOMException is supported on most modern browsers and Node.js 18+.\n// @see https://developer.mozilla.org/en-US/docs/Web/API/DOMException#browser_compatibility\nconst isDomExceptionSupported = Boolean(globalThis.DOMException);\n\n// TODO: When targeting Node.js 18, use `signal.throwIfAborted()` (https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal/throwIfAborted)\nexport function composeAbortError(signal?: AbortSignal) {\n\t/*\n\tNOTE: Use DomException with AbortError name as specified in MDN docs (https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort)\n\t> When abort() is called, the fetch() promise rejects with an Error of type DOMException, with name AbortError.\n\t*/\n\tif (isDomExceptionSupported) {\n\t\treturn new DOMException(signal?.reason ?? 'The operation was aborted.', 'AbortError');\n\t}\n\n\t// DOMException not supported. Fall back to use of error and override name.\n\tconst error = new Error(signal?.reason ?? 'The operation was aborted.');\n\terror.name = 'AbortError';\n\n\treturn error;\n}\n"]}