/** * Error handling interfaces following SOLID principles * Single Responsibility: Each interface handles specific error types * Open/Closed: Extensible for new error types without modification */ export interface BaseError { code: string; message: string; timestamp: string; context?: Record; } export interface DatabaseError extends BaseError { type: 'database'; operation: string; table?: string; query?: string; } export interface FileSystemError extends BaseError { type: 'filesystem'; operation: 'read' | 'write' | 'delete' | 'create'; path: string; permissions?: boolean; } export interface ValidationError extends BaseError { type: 'validation'; field: string; value: any; expected: string; } export interface NetworkError extends BaseError { type: 'network'; url: string; method: string; statusCode?: number; timeout?: boolean; } export interface ProjectError extends BaseError { type: 'project'; projectId?: string; projectPath?: string; operation: string; } export interface SemanticAnalysisError extends BaseError { type: 'semantic'; filePath: string; language: string; parseStage: 'lexical' | 'syntactic' | 'semantic'; } export interface ClaudeCodeError extends BaseError { type: 'claude'; operation: string; prompt?: string; apiError?: boolean; } export type CodeSeekerError = DatabaseError | FileSystemError | ValidationError | NetworkError | ProjectError | SemanticAnalysisError | ClaudeCodeError; export interface SuccessResult { success: true; data: T; } export interface ErrorResult { success: false; error: CodeSeekerError; } export type Result = SuccessResult | ErrorResult; export interface IErrorLogger { log(error: CodeSeekerError): Promise; logWithContext(error: CodeSeekerError, context: Record): Promise; } export interface IErrorReporter { report(error: CodeSeekerError): Promise; reportCritical(error: CodeSeekerError): Promise; } export interface IErrorRecovery { canRecover(error: CodeSeekerError): boolean; recover(error: CodeSeekerError): Promise>; } export interface IErrorFactory { createDatabaseError(operation: string, message: string, context?: any): DatabaseError; createFileSystemError(operation: 'read' | 'write' | 'delete' | 'create', path: string, message: string): FileSystemError; createValidationError(field: string, value: any, expected: string): ValidationError; createNetworkError(url: string, method: string, message: string, statusCode?: number): NetworkError; createProjectError(operation: string, message: string, projectId?: string, projectPath?: string): ProjectError; createSemanticAnalysisError(filePath: string, language: string, stage: 'lexical' | 'syntactic' | 'semantic', message: string): SemanticAnalysisError; createClaudeCodeError(operation: string, message: string, prompt?: string): ClaudeCodeError; } export interface IErrorHandler { handle(error: CodeSeekerError): Promise>; handleWithRecovery(error: CodeSeekerError): Promise>; isRecoverable(error: CodeSeekerError): boolean; } export interface IErrorMiddleware { process(error: CodeSeekerError): Promise; enrichWithContext(error: CodeSeekerError, context: Record): CodeSeekerError; } //# sourceMappingURL=error-interfaces.d.ts.map