UNPKG

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

65 lines (62 loc) 2.23 kB
import { AIProcessor } from '../../ai/AIProcessor.js'; /** * Error Handling Processor generates comprehensive error handling guidelines * covering error handling strategies, logging, recovery, and monitoring. */ export class ErrorHandlingProcessor { aiProcessor; constructor() { this.aiProcessor = AIProcessor.getInstance(); } async process(context) { try { const prompt = this.createPrompt(context); const content = await this.aiProcessor.makeAICall([ { role: 'system', content: 'You are a software architect with expertise in error handling and system reliability.' }, { role: 'user', content: prompt } ]).then(res => typeof res === 'string' ? res : res.content); await this.validateOutput(content); return { title: 'Error Handling Guidelines', content }; } catch (error) { console.error('Error processing Error Handling Guidelines:', error); throw new Error(`Failed to generate Error Handling Guidelines: ${error instanceof Error ? error.message : String(error)}`); } } createPrompt(context) { return `Based on the following project context, generate comprehensive Error Handling Guidelines. Project Context: - Name: ${context.projectName} - Type: ${context.projectType} - Description: ${context.description} The document should include: 1. Error Handling Strategy 2. Error Categories 3. Error Logging 4. Error Reporting 5. Recovery Procedures 6. Retry Mechanisms 7. Circuit Breakers 8. User Error Messages 9. Monitoring and Alerts 10. Troubleshooting Guide Requirements: 1. Define error handling patterns 2. Include logging standards 3. Address user experience 4. Consider monitoring 5. Document recovery procedures`; } async validateOutput(content) { if (!content || content.trim().length === 0) { throw new Error('Generated content is empty'); } if (content.length < 500) { console.warn('Generated content seems unusually short for error handling guidelines'); } } } //# sourceMappingURL=ErrorhandlingProcessor.js.map