/** * What went wrong, as one of: * * - `NotFound` / `Unauthorized` / `Conflict` — the provider's answer. * - `ReadOnly` — a write on a read-only instance. * - `Invalid` — the call itself is wrong: a malformed argument, a * contradictory option, or bad constructor config. Fix the call. * - `Unsupported` — the call is well-formed, but this adapter (in this mode, * with these plugins) can't do it. Check `files.capabilities` first. * - `Provider` — the backend or transport failed. The only retried code. */ export type FilesErrorCode = "NotFound" | "Unauthorized" | "Conflict" | "ReadOnly" | "Invalid" | "Unsupported" | "Provider"; /** The codes a provider's own response maps to. */ export type ProviderFilesErrorCode = Exclude; export declare class FilesError extends Error { static [Symbol.hasInstance](value: unknown): boolean; readonly code: FilesErrorCode; readonly aborted: boolean; /** * `true` when the operation was cut off by a configured `timeout` rather * than a caller's abort signal. Timeouts also set `aborted` (the attempt * was cancelled either way), so this is the bit that tells "the backend * hung" apart from "the caller changed their mind" — `failover()` uses it * to try the next backend on a timeout but respect a deliberate abort. */ readonly timedOut: boolean; /** * `true` when the failure is deterministic — re-issuing the identical * request can only fail the same way. Always `true` for `Invalid`, * `Unsupported`, and `ReadOnly`. `Provider`-coded errors are otherwise * presumed transient and retried; this flag opts a specific one out of that * (a host that ignores `Range`, corrupt stored data). */ readonly permanent: boolean; /** * `true` when a conditional mutation **did commit** at the provider before * this error was raised — an awaited plugin threw after `next()` returned, * or the committed result failed a post-commit check. The object changed * (for an upload, to the generation in {@link appliedEtag}) even though the * call rejected, so treat it as applied-but-unacknowledged: reconcile with * an exact read rather than re-issuing the same predicate, which can only * conflict now. Never set on a pre-commit veto or a provider failure. */ readonly applied: boolean; /** The committed generation's ETag when {@link applied} is set on an upload. */ readonly appliedEtag?: string; /** * The original provider error, preserved for debugging. * * **Logging note:** provider errors (especially from `@aws-sdk`) can carry * fields like request IDs, response headers, and partial request metadata. * If you serialize `FilesError` into logs that cross a trust boundary, * consider stripping `cause` or whitelisting fields rather than * `JSON.stringify`-ing the whole thing. */ readonly cause?: unknown; constructor(code: FilesErrorCode, message: string, cause?: unknown, opts?: { aborted?: boolean; timedOut?: boolean; permanent?: boolean; applied?: boolean; appliedEtag?: string; }); /** * Re-raise `cause` as the outcome of a conditional mutation that already * committed: same code, message, and flags, with {@link applied} set (and * {@link appliedEtag} for uploads). The original error is kept as `cause` * so nothing about the failure is lost. */ static applied(cause: unknown, appliedEtag?: string): FilesError; static wrap(cause: unknown, fallbackCode?: FilesErrorCode): FilesError; } /** * The `Unsupported` error an adapter throws from `url()` when it cannot honor * `responseContentDisposition` (so it is `permanent`: neither retried nor * failed over), branded so {@link isDispositionUnsupported} can recognize it * across bundle copies. */ export declare const dispositionUnsupported: (message: string) => FilesError; /** Whether `error` is an adapter's {@link dispositionUnsupported} refusal. */ export declare const isDispositionUnsupported: (error: unknown) => boolean; //# sourceMappingURL=errors.d.ts.map