/** * FedPulse SDK error classes. * * All errors thrown by the SDK extend FedPulseError so callers can use * `instanceof FedPulseError` to distinguish SDK errors from other exceptions. */ /** * Base class for all FedPulse SDK errors. */ export declare class FedPulseError extends Error { /** HTTP status code returned by the API, or 0 for network errors. */ readonly status: number; /** Machine-readable error code from the API (e.g. NOT_FOUND, RATE_LIMIT_EXCEEDED). */ readonly code: string; /** Request ID for debugging — correlates with API logs. */ readonly requestId: string | undefined; /** Additional structured details from the API response. */ readonly details: unknown | undefined; constructor({ message, status, code, requestId, details, }: { message: string; status: number; code: string; requestId?: string; details?: unknown; }); } /** * Thrown when the API returns 401 Unauthorized. * Usually caused by missing, invalid, or revoked API key / JWT. */ export declare class AuthenticationError extends FedPulseError { constructor(params: { message: string; requestId?: string; details?: unknown; }); } /** * Thrown when the API returns 403 Forbidden. * Usually caused by insufficient plan permissions or missing key scope. */ export declare class PermissionError extends FedPulseError { constructor(params: { message: string; code?: string; requestId?: string; details?: unknown; }); } /** * Thrown when the API returns 404 Not Found. */ export declare class NotFoundError extends FedPulseError { constructor(params: { message: string; requestId?: string; details?: unknown; }); } /** * Thrown when the API returns 422 Unprocessable Entity or 400 Bad Request * due to invalid request parameters or body. */ export declare class ValidationError extends FedPulseError { constructor(params: { message: string; status?: number; requestId?: string; details?: unknown; }); } /** * Thrown when the API returns 429 Too Many Requests. * The `retryAfter` property indicates when the rate limit resets (Unix seconds). */ export declare class RateLimitError extends FedPulseError { /** Unix epoch seconds when the rate limit window resets. */ readonly retryAfter: number | undefined; constructor(params: { message: string; retryAfter?: number; requestId?: string; details?: unknown; }); } /** * Thrown when the API returns a 5xx server error. */ export declare class ServerError extends FedPulseError { constructor(params: { message: string; status?: number; code?: string; requestId?: string; details?: unknown; }); } /** * Thrown when a network-level failure occurs (DNS, TCP, timeout, ECONNREFUSED). * The `cause` property contains the original error. */ export declare class NetworkError extends FedPulseError { /** The underlying network error. */ readonly cause: Error; constructor(params: { message: string; cause: Error; }); } /** * Thrown when a request exceeds the configured timeout. */ export declare class TimeoutError extends FedPulseError { constructor(params: { message: string; requestId?: string; }); } /** * Thrown when the SDK's retry budget is exhausted. * The `lastError` property contains the final underlying error. */ export declare class RetryExhaustedError extends FedPulseError { readonly lastError: FedPulseError; readonly attempts: number; constructor(params: { lastError: FedPulseError; attempts: number; }); } /** * Factory — parses a raw API error response object into the correct error subtype. * * @param status HTTP response status code. * @param body Parsed JSON body (may be the error envelope or anything). * @param headers Response headers map (used for Retry-After). */ export declare function createApiError(status: number, body: unknown, headers: Record): FedPulseError; //# sourceMappingURL=errors.d.ts.map