UNPKG

@tachui/devtools

Version:

Development & debugging tools for tachUI framework

204 lines 5.21 kB
/** * Error Handling Utilities and Debugging Tools (Phase 3.2.3) * * Comprehensive utilities for error handling, debugging, and development tools. * Provides helper functions, debugging aids, and error analysis tools. */ import type { ErrorCategory, ErrorSeverity, TachUIError } from './error-boundary'; import type { ErrorAggregation, LogEntry } from './error-reporting'; /** * Error analysis result */ export interface ErrorAnalysis { totalErrors: number; errorsByCategory: Record<ErrorCategory, number>; errorsBySeverity: Record<ErrorSeverity, number>; topErrors: ErrorAggregation[]; recentErrors: TachUIError[]; errorTrends: { category: ErrorCategory; trend: 'increasing' | 'decreasing' | 'stable'; change: number; }[]; recommendations: string[]; } /** * Stack trace analysis */ export interface StackTraceAnalysis { frames: { function: string; file: string; line: number; column: number; source?: string; }[]; rootCause?: string; affectedComponents: string[]; suggestedFixes: string[]; } /** * Performance impact analysis */ export interface PerformanceImpact { errorCount: number; averageRenderTime: number; memoryUsage: number; affectedComponents: string[]; performanceDegradation: number; } /** * Error pattern detector */ export declare class ErrorPatternDetector { private windowSize; /** * Analyze error patterns */ analyzePatterns(errors: TachUIError[]): { patterns: { pattern: string; count: number; severity: 'low' | 'medium' | 'high'; }[]; cascadingErrors: TachUIError[][]; correlations: { error1: string; error2: string; correlation: number; }[]; }; /** * Detect error patterns */ private detectErrorPatterns; /** * Extract pattern from error message */ private extractMessagePattern; /** * Detect cascading errors (errors that happen close together) */ private detectCascadingErrors; /** * Detect error correlations */ private detectErrorCorrelations; /** * Calculate correlation between two error types */ private calculateCorrelation; } /** * Stack trace analyzer */ export declare class StackTraceAnalyzer { /** * Analyze stack trace */ analyzeStackTrace(error: TachUIError): StackTraceAnalysis; /** * Parse stack trace into frames */ private parseStackTrace; /** * Identify root cause from stack trace */ private identifyRootCause; /** * Extract affected components from stack trace */ private extractAffectedComponents; /** * Generate suggested fixes */ private generateSuggestedFixes; } /** * Performance impact analyzer */ export declare class PerformanceImpactAnalyzer { /** * Analyze performance impact of errors */ analyzePerformanceImpact(errors: TachUIError[]): PerformanceImpact; /** * Calculate average render time for affected components */ private calculateAverageRenderTime; /** * Calculate memory usage impact */ private calculateMemoryUsage; /** * Calculate performance degradation percentage */ private calculatePerformanceDegradation; } /** * Error debugging utilities */ export declare const errorDebugUtils: { /** * Generate comprehensive error report */ generateErrorReport(): ErrorAnalysis; /** * Generate recommendations based on error analysis */ generateRecommendations(errors: TachUIError[], _aggregations: ErrorAggregation[], patterns: any): string[]; /** * Debug specific error */ debugError(errorId: string): { error: TachUIError | null; stackTrace: StackTraceAnalysis; relatedErrors: TachUIError[]; performanceImpact: PerformanceImpact; suggestions: string[]; } | null; /** * Find related errors */ findRelatedErrors(error: TachUIError): TachUIError[]; /** * Generate error-specific suggestions */ generateErrorSuggestions(error: TachUIError, stackTrace: StackTraceAnalysis, relatedErrors: TachUIError[]): string[]; /** * Log error analysis to console */ logErrorAnalysis(): void; /** * Export error data for external analysis */ exportErrorData(): { errors: TachUIError[]; logs: LogEntry[]; aggregations: ErrorAggregation[]; analysis: ErrorAnalysis; timestamp: number; }; /** * Simulate error for testing */ simulateError(category?: ErrorCategory, severity?: ErrorSeverity, message?: string): void; /** * Clear all error data */ clearAllErrorData(): void; }; /** * Development mode error utilities */ export declare const devErrorUtils: { /** * Enable enhanced error debugging */ enableEnhancedDebugging(): void; /** * Setup error monitoring dashboard */ setupErrorDashboard(): void; }; //# sourceMappingURL=error-utils.d.ts.map