adpa-enterprise-framework-automation
Version:
Modular, standards-compliant Node.js/TypeScript automation framework for enterprise requirements, project, and data management. Provides CLI and API for BABOK v3, PMBOK 7th Edition, and DMBOK 2.0 (in progress). Production-ready Express.js API with TypeSpe
101 lines • 3.19 kB
TypeScript
/**
* Interactive Error Handler
*
* Provides specialized error handling for the interactive CLI system.
* Ensures that errors don't crash the application and provides user-friendly
* error messages with recovery options.
*
* @version 1.0.0
* @author ADPA Team
*/
import { ValidationResult } from './InputValidationService.js';
export interface ErrorContext {
operation: string;
userInput?: string;
menuId?: string;
timestamp: Date;
}
export interface ErrorRecoveryOptions {
canRetry: boolean;
canGoBack: boolean;
canSkip: boolean;
suggestedActions: string[];
}
export interface InteractiveError {
type: 'validation' | 'system' | 'network' | 'configuration' | 'user' | 'unknown';
message: string;
context: ErrorContext;
recoveryOptions: ErrorRecoveryOptions;
originalError?: Error;
}
export declare class InteractiveErrorHandler {
private static errorHistory;
private static maxHistorySize;
/**
* Handle validation errors in interactive context
*/
static handleValidationError(validationResult: ValidationResult, context: ErrorContext): InteractiveError;
/**
* Handle system errors (file system, permissions, etc.)
*/
static handleSystemError(originalError: Error, context: ErrorContext): InteractiveError;
/**
* Handle network errors (API calls, downloads, etc.)
*/
static handleNetworkError(originalError: Error, context: ErrorContext): InteractiveError;
/**
* Handle configuration errors
*/
static handleConfigurationError(originalError: Error, context: ErrorContext): InteractiveError;
/**
* Handle user cancellation or interruption
*/
static handleUserCancellation(context: ErrorContext): InteractiveError;
/**
* Handle unknown errors
*/
static handleUnknownError(originalError: Error, context: ErrorContext): InteractiveError;
/**
* Display error to user with recovery options
*/
static displayError(error: InteractiveError): Promise<void>;
/**
* Get recovery action from user
*/
static getRecoveryAction(error: InteractiveError, promptFunction: (message: string) => Promise<string>): Promise<'retry' | 'back' | 'skip' | 'help' | 'exit'>;
/**
* Show recovery help
*/
static showRecoveryHelp(error: InteractiveError): void;
/**
* Log error to history
*/
private static logError;
/**
* Get error statistics
*/
static getErrorStatistics(): {
total: number;
byType: {
[key: string]: number;
};
recent: InteractiveError[];
};
/**
* Clear error history
*/
static clearErrorHistory(): void;
/**
* Wrap async operation with error handling
*/
static withErrorHandling<T>(operation: () => Promise<T>, context: ErrorContext, promptFunction: (message: string) => Promise<string>): Promise<T | null>;
/**
* Categorize error based on type and message
*/
private static categorizeError;
/**
* Show detailed help for an error
*/
private static showDetailedHelp;
}
//# sourceMappingURL=InteractiveErrorHandler.d.ts.map