import type { AppendRowError, AppendRowsErrorPayload } from "./protocol.js"; export type ErrorKind = "Unexpected" | "ConfigInvalid" /** The statement execution was rejected by the server (failed or cancelled in-band). */ | "StatementFailed" /** The table append was rejected or its commit outcome is unknown. */ | "AppendRowsFailed"; export type ErrorStatus = "permanent" | "temporary" | "persistent"; export interface ScopeDBErrorOptions { cause?: unknown; status?: ErrorStatus; /** HTTP response status, when the error came from the server. */ httpStatus?: number; /** Request identifier returned by ScopeDB or an intermediary. */ requestId?: string; /** Delay suggested by `Retry-After`, in milliseconds. */ retryAfterMs?: number; } export declare class ScopeDBError extends Error { readonly kind: ErrorKind; readonly httpStatus?: number; readonly requestId?: string; readonly retryAfterMs?: number; private errorStatus; private readonly errorContext; constructor(kind: ErrorKind, message: string, options?: ScopeDBErrorOptions); /** Whether retrying is appropriate for this error classification. */ get retryable(): boolean; withContext(key: string, value: string | number | boolean): this; context(): ReadonlyMap; status(): ErrorStatus; setPermanent(): this; setTemporary(): this; setPersistent(): this; isPermanent(): boolean; isTemporary(): boolean; isPersistent(): boolean; toString(): string; } export declare class AppendRowsError extends ScopeDBError { readonly appendState: AppendRowsErrorPayload["append_state"]; readonly rowErrors: readonly AppendRowError[]; readonly rowErrorsTruncated: boolean; constructor(payload: AppendRowsErrorPayload, message: string, options?: ScopeDBErrorOptions); } export declare function asScopeDBError(kind: ErrorKind, message: string, cause: unknown): ScopeDBError; //# sourceMappingURL=errors.d.ts.map