export declare enum ErrorCode { VALIDATION_ERROR = "VALIDATION_ERROR", AI_SERVICE_ERROR = "AI_SERVICE_ERROR", FILE_SYSTEM_ERROR = "FILE_SYSTEM_ERROR", NETWORK_ERROR = "NETWORK_ERROR", CONFIGURATION_ERROR = "CONFIGURATION_ERROR", PARSER_ERROR = "PARSER_ERROR", GENERATOR_ERROR = "GENERATOR_ERROR", UNKNOWN_ERROR = "UNKNOWN_ERROR" } export interface ErrorContext { operation?: string; file?: string; line?: number; component?: string; metadata?: Record; } export declare class ScribeVerseError extends Error { readonly code: ErrorCode; readonly context: ErrorContext; readonly originalError?: Error; readonly timestamp: Date; constructor(message: string, code?: ErrorCode, context?: ErrorContext, originalError?: Error); toJSON(): Record; } export declare class ErrorHandler { private static instance; private errorHandlers; static getInstance(): ErrorHandler; /** * Register a custom error handler for specific error codes */ registerHandler(code: ErrorCode, handler: (error: ScribeVerseError) => void): void; /** * Handle an error with proper logging and context */ handle(error: Error | ScribeVerseError, context?: ErrorContext): ScribeVerseError; /** * Safely execute an async function with error handling */ safeExecute(operation: () => Promise, context?: ErrorContext): Promise<{ success: true; data: T; } | { success: false; error: ScribeVerseError; }>; /** * Safely execute a sync function with error handling */ safeExecuteSync(operation: () => T, context?: ErrorContext): { success: true; data: T; } | { success: false; error: ScribeVerseError; }; private determineErrorCode; private logError; } /** * Utility functions for common error handling patterns */ export declare const ErrorUtils: { /** * Wrap an async function to automatically handle errors */ withErrorHandling: (fn: (...args: T) => Promise, context?: Partial) => (...args: T) => Promise; /** * Wrap a sync function to automatically handle errors */ withErrorHandlingSync: (fn: (...args: T) => R, context?: Partial) => (...args: T) => R; /** * Create a validation error with context */ validationError: (message: string, field?: string, value?: any) => ScribeVerseError; /** * Create a file system error with context */ fileSystemError: (message: string, filePath?: string, originalError?: Error) => ScribeVerseError; /** * Create an AI service error with context */ aiServiceError: (message: string, provider?: string, originalError?: Error) => ScribeVerseError; }; //# sourceMappingURL=error-handler.d.ts.map