/** * Storage Error Classes * * Custom error types for storage operations. * All errors extend StorageError for easy catching. */ /** * Base error class for all storage-related errors. */ export declare class StorageError extends Error { readonly cause?: Error; constructor(message: string, cause?: Error); } /** * Error thrown when storage connection fails. * * @example * ```typescript * throw new StorageConnectionError( * 'Failed to connect to Redis', * originalError * ); * ``` */ export declare class StorageConnectionError extends StorageError { readonly backend?: string | undefined; constructor(message: string, cause?: Error, backend?: string | undefined); } /** * Error thrown when a storage operation fails. * * @example * ```typescript * throw new StorageOperationError( * 'set', * 'user:123', * 'Value too large', * originalError * ); * ``` */ export declare class StorageOperationError extends StorageError { readonly operation: string; readonly key: string; constructor(operation: string, key: string, message: string, cause?: Error); } /** * Error thrown when a feature is not supported by the adapter. * * @example * ```typescript * throw new StorageNotSupportedError( * 'publish', * 'vercel-kv', * 'Vercel KV does not support pub/sub. Use Upstash instead.' * ); * ``` */ export declare class StorageNotSupportedError extends StorageError { readonly operation: string; readonly backend: string; constructor(operation: string, backend: string, suggestion?: string); } /** * Error thrown when storage configuration is invalid. * * @example * ```typescript * throw new StorageConfigError( * 'redis', * 'Either "client" or "config"/"url" must be provided' * ); * ``` */ export declare class StorageConfigError extends StorageError { readonly backend: string; constructor(backend: string, message: string); } /** * Error thrown when TTL value is invalid. * * @example * ```typescript * throw new StorageTTLError(-1, 'TTL must be a positive integer'); * ``` */ export declare class StorageTTLError extends StorageError { readonly ttl: unknown; constructor(ttl: unknown, message?: string); } /** * Error thrown when a key pattern is invalid or potentially dangerous. * * @example * ```typescript * throw new StoragePatternError( * pattern, * 'Pattern is too complex and may cause ReDoS' * ); * ``` */ export declare class StoragePatternError extends StorageError { readonly pattern: string; constructor(pattern: string, message: string); } /** * Error thrown when storage is not connected. * * @example * ```typescript * throw new StorageNotConnectedError('redis'); * ``` */ export declare class StorageNotConnectedError extends StorageError { readonly backend: string; constructor(backend: string); } /** * Error thrown when encryption/decryption operations fail. * * @example * ```typescript * throw new EncryptedStorageError('Failed to decrypt: invalid key'); * ``` */ export declare class EncryptedStorageError extends StorageError { constructor(message: string); }