/** * UI18n运行时错误管理器 * 提供用户友好的错误提示、本地化消息和框架特定的错误处理 */ import { SmartError, SmartErrorType, ErrorSeverity, ErrorContext, FrameworkErrorAdapter, ErrorHandlerConfig } from './types'; import { SupportedLanguage } from '../types'; import { FallbackErrorType } from '../fallback-manager'; export interface ErrorHistoryItem { error: SmartError; timestamp: number; resolved: boolean; resolutionMethod?: string; } export interface RuntimeErrorStats { totalErrors: number; errorsByType: Record; errorsBySeverity: Record; resolutionSuccess: number; averageResolutionTime: number; } export declare class RuntimeErrorManager { private config; private currentLanguage; private errorHistory; private frameworkAdapters; private activeErrors; private errorStats; constructor(config?: Partial); /** * 初始化框架适配器 */ private initializeFrameworkAdapters; /** * 注册框架适配器 */ registerFrameworkAdapter(adapter: FrameworkErrorAdapter): void; /** * 设置当前语言 */ setLanguage(language: SupportedLanguage): void; /** * 处理运行时错误 */ handleRuntimeError(error: Error | any, context: ErrorContext, errorType?: SmartErrorType | FallbackErrorType): Promise; /** * 创建智能错误对象 */ private createSmartError; /** * 智能检测错误类型 */ private detectErrorType; /** * 获取错误消息模板 */ private getErrorTemplate; /** * 创建回退错误消息 */ private createFallbackMessage; /** * 创建回退用户提示 */ private createFallbackHint; /** * 生成建议的解决方案 */ private generateSuggestedActions; /** * 提取技术详情 */ private extractTechnicalDetails; /** * 获取相关文档链接 */ private getRelevantDocumentation; /** * 尝试自动修复 */ private attemptAutoFix; /** * 执行自动修复 */ private executeAutoFix; /** * 显示错误 */ private displayError; /** * 在控制台显示错误 */ private displayErrorInConsole; /** * 记录错误 */ private recordError; /** * 判断是否应该记录错误 */ private shouldLogError; /** * 更新错误统计 */ private updateStats; /** * 标记错误为已解决 */ markErrorResolved(error: SmartError, resolutionMethod: string): void; /** * 添加到错误历史 */ private addToHistory; /** * 获取错误统计 */ getErrorStats(): RuntimeErrorStats; /** * 获取活跃错误 */ getActiveErrors(): SmartError[]; /** * 获取错误历史 */ getErrorHistory(): ErrorHistoryItem[]; /** * 清理资源 */ destroy(): void; } //# sourceMappingURL=runtime-error-manager.d.ts.map