@mrtkrcm/acp-claude-code
Version:
ACP (Agent Client Protocol) bridge for Claude Code
95 lines • 2.83 kB
TypeScript
/**
* Enhanced error handling and classification system for ACP-Claude-Code Bridge
*/
export declare enum ErrorCategory {
SECURITY = "security",
NETWORK = "network",
FILESYSTEM = "filesystem",
PROTOCOL = "protocol",
AUTHENTICATION = "authentication",
RESOURCE = "resource",
VALIDATION = "validation",
CLAUDE_SDK = "claude_sdk",
SESSION = "session",
UNKNOWN = "unknown"
}
export declare enum ErrorSeverity {
CRITICAL = "critical",
HIGH = "high",
MEDIUM = "medium",
LOW = "low"
}
export interface ClassifiedError {
category: ErrorCategory;
severity: ErrorSeverity;
code: string;
message: string;
originalError: Error;
context?: Record<string, unknown>;
recoverable: boolean;
retryable: boolean;
suggestedAction?: string;
}
export declare class ErrorClassifier {
/**
* Classify an error based on its characteristics
*/
static classify(error: Error, context?: Record<string, unknown>): ClassifiedError;
private static isSecurityError;
private static getSecurityErrorCode;
private static isNetworkError;
private static getNetworkErrorCode;
private static isFilesystemError;
private static getFilesystemErrorCode;
private static isAuthenticationError;
private static isClaudeSDKError;
private static getClaudeSDKErrorCode;
private static isSessionError;
private static getSessionErrorCode;
private static isProtocolError;
private static isValidationError;
}
export declare class ErrorRecovery {
/**
* Attempt to recover from a classified error
*/
static attemptRecovery(classifiedError: ClassifiedError, context?: {
sessionId?: string;
retryCount?: number;
maxRetries?: number;
}): Promise<{
success: boolean;
message: string;
}>;
private static recoverFromNetworkError;
private static recoverFromSessionError;
private static recoverFromFilesystemError;
private static recoverFromAuthError;
}
export declare class ErrorLogger {
private static logFile?;
static configure(logFile?: string): void;
/**
* Log classified error with structured format
*/
static log(classifiedError: ClassifiedError, context?: Record<string, unknown>): Promise<void>;
private static getConsoleLogLevel;
}
/**
* Utility function to handle errors consistently across the application
*/
export declare function handleError(error: Error, context?: Record<string, unknown>, options?: {
log?: boolean;
recover?: boolean;
retryContext?: {
retryCount?: number;
maxRetries?: number;
};
}): Promise<{
classified: ClassifiedError;
recovery?: {
success: boolean;
message: string;
};
}>;
//# sourceMappingURL=error-handling.d.ts.map