/** * Error codes returned by the Mandaitor API. * Use these constants for programmatic error handling. */ export declare const ErrorCodes: { readonly INVALID_REQUEST: "INVALID_REQUEST"; readonly INVALID_SCOPE: "INVALID_SCOPE"; readonly INVALID_CONSTRAINTS: "INVALID_CONSTRAINTS"; readonly TAXONOMY_VALIDATION_FAILED: "TAXONOMY_VALIDATION_FAILED"; readonly MISSING_API_KEY: "MISSING_API_KEY"; readonly INVALID_API_KEY: "INVALID_API_KEY"; readonly API_KEY_EXPIRED: "API_KEY_EXPIRED"; readonly TENANT_SUSPENDED: "TENANT_SUSPENDED"; readonly INSUFFICIENT_PERMISSIONS: "INSUFFICIENT_PERMISSIONS"; readonly MANDATE_NOT_FOUND: "MANDATE_NOT_FOUND"; readonly EVENT_NOT_FOUND: "EVENT_NOT_FOUND"; readonly TENANT_NOT_FOUND: "TENANT_NOT_FOUND"; readonly MANDATE_ALREADY_REVOKED: "MANDATE_ALREADY_REVOKED"; readonly MANDATE_ALREADY_SUSPENDED: "MANDATE_ALREADY_SUSPENDED"; readonly DUPLICATE_REQUEST: "DUPLICATE_REQUEST"; readonly RATE_LIMIT_EXCEEDED: "RATE_LIMIT_EXCEEDED"; readonly INTERNAL_ERROR: "INTERNAL_ERROR"; readonly KMS_SIGNING_FAILED: "KMS_SIGNING_FAILED"; readonly DATABASE_ERROR: "DATABASE_ERROR"; }; /** Union of the machine-readable error code strings in {@link ErrorCodes}. */ export type ErrorCode = (typeof ErrorCodes)[keyof typeof ErrorCodes]; /** * Typed error class for Mandaitor API errors. * Thrown by MandaitorClient when the API returns a non-2xx response. * * @example * try { * await client.getMandate("mnd_nonexistent"); * } catch (err) { * if (err instanceof MandaitorApiError) { * if (err.code === ErrorCodes.MANDATE_NOT_FOUND) { * // Handle 404 * } * console.error(`[${err.status}] ${err.code}: ${err.message}`); * } * } */ export declare class MandaitorApiError extends Error { /** HTTP status code (e.g. 400, 404, 500) */ readonly status: number; /** Machine-readable error code from ErrorCodes */ readonly code: string; /** Optional request ID for support debugging */ readonly requestId?: string | undefined; readonly name: string; constructor( /** HTTP status code (e.g. 400, 404, 500) */ status: number, /** Machine-readable error code from ErrorCodes */ code: string, /** Human-readable error message */ message: string, /** Optional request ID for support debugging */ requestId?: string | undefined); /** Returns true if this is a client error (4xx) */ get isClientError(): boolean; /** Returns true if this is a server error (5xx) — safe to retry */ get isRetryable(): boolean; /** Structured JSON representation for logging */ toJSON(): { name: string; status: number; code: string; message: string; requestId: string | undefined; }; } /** * Thrown when the API returns a 400 Bad Request response. */ export declare class MandaitorValidationError extends MandaitorApiError { readonly name = "MandaitorValidationError"; constructor(code: string, message: string, requestId?: string); } /** * Thrown when the API returns a 401 Unauthorized response. */ export declare class MandaitorAuthError extends MandaitorApiError { readonly name = "MandaitorAuthError"; constructor(code: string, message: string, requestId?: string); } /** * Thrown when the API returns a 403 Forbidden response. */ export declare class MandaitorForbiddenError extends MandaitorApiError { readonly name = "MandaitorForbiddenError"; constructor(code: string, message: string, requestId?: string); } /** * Thrown when the API returns a 404 Not Found response. */ export declare class MandaitorNotFoundError extends MandaitorApiError { readonly name = "MandaitorNotFoundError"; constructor(code: string, message: string, requestId?: string); } /** * Thrown when the API returns a 409 Conflict response. */ export declare class MandaitorConflictError extends MandaitorApiError { readonly name = "MandaitorConflictError"; constructor(code: string, message: string, requestId?: string); } /** * Thrown when the API returns a 429 Too Many Requests response. * Contains the number of milliseconds to wait before retrying. */ export declare class MandaitorRateLimitError extends MandaitorApiError { readonly name = "MandaitorRateLimitError"; /** Milliseconds to wait before retrying (from Retry-After header, or exponential backoff) */ readonly retryAfterMs: number; constructor(code: string, message: string, retryAfterMs: number, requestId?: string); } /** * Thrown when the request times out (AbortController signal). */ export declare class MandaitorTimeoutError extends Error { readonly timeoutMs: number; readonly url: string; readonly name = "MandaitorTimeoutError"; constructor(timeoutMs: number, url: string); } //# sourceMappingURL=errors.d.ts.map