import type { CcRequest } from '../../types/request.types.js'; import { CcNetworkError } from './cc-client-errors.js'; /** * Names the given rejection as a {@link CcNetworkError} when it is a network failure, `null` otherwise. * * Call this on the raw rejection, which is the only place the failure is still described: `fetch()` * rejects with a `TypeError` whose `cause` carries the platform error, and that description is gone as * soon as anything wraps it. Consumers holding an error the client already named want `isNetworkError` * from `utils/error-utils.js` instead. * * Beware that in a browser this covers more than an unreachable server: a rejected CORS preflight, a * request blocked by an extension, by mixed content or by a CSP rule all reject the exact same way, and * the specification is what makes them indistinguishable — the opacity is the point. So a * {@link CcNetworkError} with no {@link CcNetworkError.networkCode} means "the browser refused to say", * and retrying it will not fix a misconfiguration. * * @param error - The rejection to name * @param request - The request that failed */ export declare function asNetworkError(error: unknown, request: CcRequest): CcNetworkError | null; /** * Whether the given `fetch()` rejection is a network failure. * * @param error - The rejection to test */ export declare function isFetchNetworkError(error: unknown): boolean; //# sourceMappingURL=network-error.d.ts.map