/** * Structured error types for pattern-related operations with user-friendly messages * and recovery suggestions */ import type { FilterOptions } from '../types/index.js'; /** * Base error class for all pattern-related errors */ export declare abstract class PatternError extends Error { readonly code: string; readonly context: Record; readonly recoverySuggestions: string[]; readonly documentationLinks: string[]; readonly isRecoverable: boolean; constructor(message: string, code: string, context?: Record, recoverySuggestions?: string[], documentationLinks?: string[], isRecoverable?: boolean); /** * Get formatted error message for CLI display */ getFormattedMessage(): string; /** * Convert error to structured object for API responses */ toJSON(): Record; } /** * Error for malformed or syntactically invalid patterns */ export declare class InvalidPatternSyntaxError extends PatternError { constructor(pattern: string, reason: string, operation?: string, filePath?: string); } /** * Error for patterns that violate security policies */ export declare class SecurityViolationError extends PatternError { constructor(pattern: string, violation: string, operation?: string, filePath?: string); } /** * Error when patterns create impossible or conflicting conditions */ export declare class PatternConflictError extends PatternError { constructor(includePatterns: string[], excludePatterns: string[], conflictType: 'ALL_EXCLUDED' | 'CONTRADICTORY' | 'INEFFECTIVE', operation?: string, filePath?: string); } /** * Error for filesystem-related issues during pattern operations */ export declare class FileSystemError extends PatternError { constructor(path: string, operation: string, cause: string, systemError?: Error); } /** * Error for unexpected conditions that indicate potential bugs */ export declare class UnexpectedPatternError extends PatternError { constructor(operation: string, cause: string, context?: Record, originalError?: Error); } /** * Error for performance-related issues with patterns */ export declare class PatternPerformanceError extends PatternError { constructor(patterns: string[], issue: string, metrics: Record, operation?: string); } /** * Utility function to wrap unknown errors as PatternError instances */ export declare function wrapUnknownError(error: unknown, operation: string, context?: Record): PatternError; /** * Utility function to create pattern conflict errors from analysis results */ export declare function createPatternConflictFromAnalysis(options: FilterOptions, stats: { totalCandidateFiles: number; includedFiles: number; finalFiles: number; excludedFiles: number; }, operation?: string, filePath?: string): PatternConflictError | null; /** * Exit codes for CLI error handling */ export declare const EXIT_CODES: { readonly SUCCESS: 0; readonly INVALID_PATTERN: 10; readonly SECURITY_VIOLATION: 11; readonly PATTERN_CONFLICT: 12; readonly FILESYSTEM_ERROR: 13; readonly PERFORMANCE_ERROR: 14; readonly UNEXPECTED_ERROR: 99; }; /** * Get appropriate exit code for a PatternError */ export declare function getExitCode(error: PatternError): number; /** * Display a PatternError to the console with appropriate formatting */ export declare function displayError(error: PatternError, verbose?: boolean): void; //# sourceMappingURL=pattern-errors.d.ts.map