/** * State Management Errors * * Custom error types for state serialization and persistence. */ /** * Error codes for state management operations. */ export declare enum StateErrorCode { /** Failed to serialize state to string */ SERIALIZATION_FAILED = "SERIALIZATION_FAILED", /** Failed to deserialize string to state */ DESERIALIZATION_FAILED = "DESERIALIZATION_FAILED", /** Session not found in storage */ SESSION_NOT_FOUND = "SESSION_NOT_FOUND", /** Storage operation failed (I/O, permissions, etc.) */ STORAGE_ERROR = "STORAGE_ERROR", /** State version mismatch (needs migration) */ VERSION_MISMATCH = "VERSION_MISMATCH", /** Invalid state structure */ INVALID_STATE = "INVALID_STATE", /** Session ID format is invalid */ INVALID_SESSION_ID = "INVALID_SESSION_ID" } /** * Base error class for state management operations. */ export declare class StateError extends Error { /** * Error code for programmatic handling */ readonly code: StateErrorCode; /** * Original error that caused this error (if any) */ readonly cause?: Error; constructor(message: string, code: StateErrorCode, cause?: Error); /** * Create a serialization error */ static serialization(message: string, cause?: Error): StateError; /** * Create a deserialization error */ static deserialization(message: string, cause?: Error): StateError; /** * Create a session not found error */ static sessionNotFound(sessionId: string): StateError; /** * Create a storage error */ static storage(message: string, cause?: Error): StateError; /** * Create a version mismatch error */ static versionMismatch(expected: number, actual: number): StateError; /** * Create an invalid state error */ static invalidState(message: string): StateError; /** * Create an invalid session ID error */ static invalidSessionId(sessionId: string): StateError; }