/** * Base error class for SDK errors * * All SDK errors extend this class, providing consistent * structure for error handling and serialization. */ /** * Options for creating a ComplianceError */ export interface ComplianceErrorOptions { /** * Request ID for tracing (from X-Request-ID header) */ requestId?: string; /** * Additional error details */ details?: Record; /** * Original error that caused this error */ cause?: Error; } /** * JSON representation of a ComplianceError */ export interface ComplianceErrorJSON { name: string; code: string; message: string; requestId?: string; details?: Record; } /** * Base error class for all SDK errors. * * Provides consistent structure for: * - Error codes for programmatic handling * - Request IDs for debugging * - Additional details * - JSON serialization * * @example * ```typescript * try { * await sdk.clients.retrieve("invalid-id"); * } catch (error) { * if (error instanceof ComplianceError) { * console.log("Error code:", error.code); * console.log("Request ID:", error.requestId); * // Send to logging service * logger.error(error.toJSON()); * } * } * ``` */ export declare class ComplianceError extends Error { /** * Error code for programmatic handling. * Examples: "VALIDATION_ERROR", "NOT_FOUND", "UNAUTHORIZED" */ readonly code: string; /** * Request ID for tracing (from X-Request-ID header). * Useful for debugging with support. */ readonly requestId?: string; /** * Additional error details. * Structure varies by error type. */ readonly details?: Record; constructor(message: string, code: string, options?: ComplianceErrorOptions); /** * Serializes the error to a JSON-compatible object. * Useful for logging and error alerting. * * @returns JSON representation of the error */ toJSON(): ComplianceErrorJSON; /** * Returns a string suitable for sending to support. * Includes request ID if available. */ toSupportInfo(): string; } /** * Thrown when a scoped SDK read is given an explicit scope filter without * `crossScope: true`. The scoped SDK injects its own scope filter; passing * one explicitly is ambiguous, so we fail loudly before the network call. */ export declare class ScopeViolationError extends ComplianceError { constructor(scope: string, key: "scope" | "scopes"); }