//#region src/errors/index.d.ts /** * SDK Error Types * * Structured errors with codes, retry hints, and context. */ /** Error categories for routing and handling */ type ErrorCode = "NETWORK" | "TIMEOUT" | "AUTH" | "AUTH_EXPIRED" | "VALIDATION" | "NOT_FOUND" | "RATE_LIMITED" | "SERVER" | "CANCELLED" | "UNKNOWN"; /** SDK error with structured metadata */ declare class SDKError extends Error { readonly code: ErrorCode; readonly status?: number; readonly retryable: boolean; readonly retryAfterMs?: number; readonly context?: Record; constructor(message: string, options: { code: ErrorCode; status?: number; retryable?: boolean; retryAfterMs?: number; context?: Record; cause?: Error; }); private inferRetryable; /** Create from HTTP response */ static fromResponse(status: number, body?: unknown): SDKError; /** Create from caught error */ static fromError(error: unknown): SDKError; /** * Extract a human-readable message from a parsed error response body. * * Probes shapes seen across our upstreams: * - `{ message: "..." }` — most internal services * - `{ error: "..." }` — flat-error shape * - `{ error: { message: "..." } }` — Hetzner Cloud API * - `{ error: { details: "..." } }` — Hetzner field-level details * - `string` — non-JSON text/plain errors * * Returns null if no message-like field is present so callers can * fall back to "HTTP ". Without this, Hetzner 422s logged * as opaque "HTTP 422" because the message lives at * `body.error.message`, blocking diagnosis of every autoscaler * failure (issue #785). */ private static extractMessageFromBody; /** Check if error is retryable after token refresh */ isAuthExpired(): boolean; } /** Type guard for SDKError */ declare function isSDKError(error: unknown): error is SDKError; /** Type guard for retryable errors */ declare function isRetryable(error: unknown): boolean; //#endregion export { isSDKError as i, SDKError as n, isRetryable as r, ErrorCode as t }; //# sourceMappingURL=index-BFYASYJk.d.ts.map