/** * Error Diagnostics Utilities * * Provides utilities for diagnosing and reporting errors with context * * @requirement TASK-2.2 - Error Handling Improvements */ /** * Error context information */ export interface ErrorContext { operation: string; filePath?: string; directory?: string; additionalInfo?: Record; } /** * Enhanced error with context */ export declare class EnhancedError extends Error { readonly context: ErrorContext; readonly originalError: Error; readonly timestamp: string; constructor(message: string, context: ErrorContext, originalError?: Error); /** * Get formatted error message with context */ getFormattedMessage(): string; /** * Get structured error report */ getStructuredReport(): { error: string; context: ErrorContext; timestamp: string; originalError?: { message: string; name: string; stack?: string; }; }; } /** * Create enhanced error with context */ export declare function createEnhancedError(message: string, context: ErrorContext, originalError?: Error): EnhancedError; /** * Wrap error with context */ export declare function wrapError(error: Error, context: ErrorContext): EnhancedError; /** * Diagnostic information for file operations */ export declare function diagnoseFileOperation(operation: string, filePath: string): Promise<{ fileExists: boolean; directoryExists: boolean; directoryWritable: boolean; fileReadable: boolean; fileWritable: boolean; permissions?: string; }>; /** * Format error for logging */ export declare function formatErrorForLogging(error: Error, context?: ErrorContext): string; /** * Check if error is retryable */ export declare function isRetryableError(error: Error): boolean; /** * Get error recovery suggestion */ export declare function getErrorRecoverySuggestion(error: Error, context?: ErrorContext): string[];