/** * Sistema de manejo de errores detallado para CCL * Proporciona códigos de error estructurados, mensajes claros y sugerencias de solución */ import { ErrorCategory, ErrorSeverity } from './error-codes'; export { ErrorCodes, ErrorCategory, ErrorSeverity } from './error-codes'; export interface ErrorContext { operation?: string; userId?: string; sessionId?: string; requestId?: string; timestamp?: Date; metadata?: Record; stackTrace?: string; recovery?: { attempted: boolean; successful: boolean; message?: string; fallbackUsed?: boolean; data?: any; }; } export interface ErrorDetails { code: string; category: ErrorCategory; severity: ErrorSeverity; message: string; field?: string; value?: any; suggestions: string[]; context?: Record; timestamp: Date; stackTrace?: string; userMessage?: string; technicalDetails?: string; } export declare class DetailedError extends Error { readonly details: ErrorDetails; readonly originalCause?: Error; constructor(code: string, category: ErrorCategory, severity: ErrorSeverity, message: string, options?: { field?: string; value?: any; suggestions?: string[]; context?: Record; userMessage?: string; technicalDetails?: string; cause?: Error; }); getSummary(): string; getUserMessage(): string; getSuggestions(): string[]; toJSON(): Record; } export declare class ErrorFactory { static createValidationError(code: string, message: string, field: string, value: any, suggestions?: string[]): DetailedError; static createAPIError(code: string, message: string, context?: Record, suggestions?: string[]): DetailedError; static createNetworkError(code: string, message: string, suggestions?: string[]): DetailedError; static createConversionError(code: string, message: string, context?: Record, suggestions?: string[]): DetailedError; static createSystemError(code: string, message: string, suggestions?: string[]): DetailedError; static createBusinessError(code: string, message: string, suggestions?: string[]): DetailedError; } export declare class ErrorHandler { private static errorMetrics; private static errorHistory; private static readonly MAX_HISTORY; static handle(error: Error | DetailedError | null | undefined, context?: Record): Promise; private static logError; private static updateMetrics; private static addToHistory; static getMetrics(): Record; static getHistory(limit?: number): DetailedError[]; static clearHistory(): void; /** * Enriquece el error con sugerencias automáticas */ private static enrichWithSuggestions; /** * Obtiene los códigos de errores recientes */ private static getRecentErrorCodes; static getStatistics(): { totalErrors: number; errorsByCategory: Record; errorsBySeverity: Record; mostCommonErrors: Array<{ code: string; count: number; }>; }; } export declare class ErrorUtils { static isRecoverable(error: DetailedError): boolean; static getRetryDelay(error: DetailedError, attempt: number): number; static formatForUser(error: DetailedError): string; static formatForLog(error: DetailedError): string; } //# sourceMappingURL=error-handler.d.ts.map