import type { CCIPErrorCode } from './codes.ts'; /** Options for CCIPError constructor. */ export interface CCIPErrorOptions { /** Original error (ES2022 cause). */ cause?: Error; /** Structured context (IDs, addresses). */ context?: Record; /** True if retry may succeed. */ isTransient?: boolean; /** Retry delay in ms. */ retryAfterMs?: number; /** Recovery suggestion. */ recovery?: string; } /** * Base error class for CCIP SDK. * * @example * ```typescript * if (CCIPError.isCCIPError(error) && error.isTransient) { * await sleep(error.retryAfterMs ?? 5000) * } * ``` */ export declare class CCIPError extends Error { /** Brand for cross-module identification (dual package hazard). */ readonly _isCCIPError: true; /** Machine-readable error code. */ readonly code: CCIPErrorCode; /** Structured context (IDs, addresses). */ readonly context: Record; /** True if retry may succeed. */ readonly isTransient: boolean; /** Retry delay in ms. */ readonly retryAfterMs?: number; /** Recovery suggestion. */ readonly recovery?: string; readonly name: string; /** * Creates a CCIPError with code, message, and options. * * @param code - Machine-readable error code * @param message - Human-readable error message * @param options - Additional error options (cause, context, isTransient, etc.) */ constructor(code: CCIPErrorCode, message: string, options?: CCIPErrorOptions); /** * Type guard for CCIPError. * * Prefer this over `instanceof` to handle the dual package hazard * when multiple versions of the SDK may be present. * * @param error - The error to check * @returns True if the error is a CCIPError instance */ static isCCIPError(error: unknown): error is CCIPError; /** * Wraps an unknown caught value in a CCIPError. * * Useful for normalizing errors in catch blocks. * * @param error - The error to wrap * @param code - Optional error code (defaults to 'UNKNOWN') * @returns A CCIPError wrapping the original error */ static from(error: unknown, code?: CCIPErrorCode): CCIPError; /** * Serializes the error for logging. * * Use this instead of `JSON.stringify(error)` directly, as Error properties * are non-enumerable and would be lost. * * @returns An object containing all error properties */ toJSON(): Record; } //# sourceMappingURL=CCIPError.d.ts.map