/** * Transport-agnostic download error taxonomy. * * Deliberately knows nothing about curl. Exit-code classification lives in * `curl.ts` (the transport layer) because iOS Apps downloads through `ipatool` * and must not inherit curl semantics it never produces. Anything here has to * make sense for *any* transport. */ export type DownloadErrorCode = "cancelled" | "network" | "dns" | "tls" | "timeout" | "stalled" | "http_client" | "http_server" | "auth" | "forbidden" | "not_found" | "rate_limited" | "disk_full" | "permission" | "url_expired" /** * The server accepted the request but has not produced the file yet * (HTTP 202). Retryable: the same request succeeds once it is ready. */ | "pending" | "integrity" /** Caller-supplied input was rejected before any request was made. */ | "validation" /** * Another live attempt already owns this `outputPath`. * * Not retryable on its own: the other attempt has to finish, or this caller * has to pick a different path (`uniquePath` allocates one). Retrying the * same path in a loop just races the same holder again. */ | "conflict" /** * The transfer began and then stopped without recording an outcome, leaving a * partial file behind. Distinct from `runner_failed` in the one way that * matters to the user: there are bytes on disk, so resuming is worthwhile. */ | "interrupted" /** * The helper process died before transferring anything — a missing runner, an * unusable output directory, no working `node`. Not retryable: the same * environment produces the same crash, and a retry loop hides the cause. */ | "runner_failed" | "unknown"; /** * A POSIX signal name. * * Spelled as a plain string union rather than `NodeJS.Signals` so the published * declarations don't require `@types/node` — it is a dev dependency here, and a * consumer without Node ambient types would otherwise fail to typecheck. */ export type SignalName = string; export interface DownloadErrorDetail { httpStatus?: number; exitCode?: number | null; signal?: SignalName | null; cause?: unknown; } export declare class DownloadError extends Error { readonly code: DownloadErrorCode; readonly httpStatus?: number; readonly exitCode?: number | null; readonly signal?: SignalName | null; readonly retryable: boolean; /** Original underlying error, when there was one. */ readonly cause?: unknown; constructor(code: DownloadErrorCode, message: string, detail?: DownloadErrorDetail); } /** Narrow an unknown thrown value to a DownloadError. */ export declare function isDownloadError(error: unknown): error is DownloadError; /** * Map an HTTP status to a code. Shared by every transport, since they all * ultimately surface an HTTP status. * * 410 Gone is folded into `url_expired` alongside 403: for signed URLs, both * are what a lapsed signature looks like in practice, and both recover the same * way. Callers that can distinguish a genuine permission denial (Fathom's * limited-access shares) should classify that before falling back here. */ export declare function classifyHttpStatus(status: number): DownloadErrorCode; //# sourceMappingURL=errors.d.ts.map