UNPKG

codecrucible-synth

Version:

Production-Ready AI Development Platform with Multi-Voice Synthesis, Smithery MCP Integration, Enterprise Security, and Zero-Timeout Reliability

116 lines 3.93 kB
/** * Enterprise Error Handler * Integrates all enterprise error handling components for unified error management */ import { SecurityAuditLogger } from '../security/security-audit-logger.js'; import { EnterpriseConfigManager } from '../config/enterprise-config-manager.js'; import { StructuredError, ErrorCategory, ErrorSeverity, ServiceResponse } from './structured-error-system.js'; export interface EnterpriseErrorConfig { enableAuditLogging: boolean; enableMetrics: boolean; enableAlerts: boolean; maxRetryAttempts: number; circuitBreakerThreshold: number; rateLimitingEnabled: boolean; securityValidationEnabled: boolean; } export declare class EnterpriseErrorHandler { private auditLogger?; private configManager?; private config; private errorMetrics; constructor(auditLogger?: SecurityAuditLogger, configManager?: EnterpriseConfigManager, config?: Partial<EnterpriseErrorConfig>); /** * Handle error with enterprise features */ handleEnterpriseError(error: Error | StructuredError, context?: { userId?: string; sessionId?: string; requestId?: string; ipAddress?: string; userAgent?: string; operation?: string; resource?: string; [key: string]: any; }): Promise<StructuredError>; /** * Process error with enterprise features */ private processEnterpriseError; /** * Create enterprise error with enhanced context */ static createEnterpriseError(message: string, category: ErrorCategory, severity: ErrorSeverity, context?: { userId?: string; sessionId?: string; requestId?: string; ipAddress?: string; operation?: string; resource?: string; securityImplications?: string[]; businessImpact?: string; complianceIssues?: string[]; [key: string]: any; }): StructuredError; /** * Validate input with enterprise security */ static validateEnterpriseInput(input: any, fieldName: string, options?: { required?: boolean; maxLength?: number; allowedPatterns?: RegExp[]; securityLevel?: 'basic' | 'standard' | 'strict' | 'paranoid'; sanitize?: boolean; }): Promise<ServiceResponse<any>>; /** * Circuit breaker pattern for external services */ executeWithCircuitBreaker<T>(operation: () => Promise<T>, serviceName: string, context?: any): Promise<ServiceResponse<T>>; /** * Update error metrics */ private updateErrorMetrics; /** * Log to security audit system */ private logToSecurityAudit; /** * Validate security implications */ private validateSecurityImplications; /** * Process alerts for critical errors */ private processAlerts; /** * Helper methods for enterprise error handling */ private static generateEnterpriseUserMessage; private static generateEnterpriseSuggestedActions; private static isEnterpriseRetryable; private static isEnterpriseRecoverable; private static estimateResolutionTime; private static determineImpactLevel; private static identifyAffectedComponents; private static generateMitigations; private static getHttpStatusCode; private mapToAuditSeverity; private mapToAuditEventType; private assessSecurityThreat; /** * Get enterprise error metrics */ getEnterpriseMetrics(): { totalErrors: number; errorsByCategory: Record<string, number>; errorsBySeverity: Record<string, number>; recentErrors: Array<{ key: string; count: number; lastOccurrence: Date; }>; circuitBreakerStatus: Record<string, boolean>; }; } export declare const enterpriseErrorHandler: EnterpriseErrorHandler; //# sourceMappingURL=enterprise-error-handler.d.ts.map