dallbit Prompt & Skill

Error Handling Systematizer

Integrates fragmented error handling into custom classes and consistent formats.

Prompt Template

The more specific your inputs, the higher the quality of the output.

{{source_code}}

You are a backend reliability architect. Systematize the fragmented error handling in the following code into a consistent system. ### Source Code throw new Error('Something failed'); ### Design Tasks 1. **Error Classes**: Design domain-specific custom error classes. 2. **Hierarchy**: Define the inheritance hierarchy and error codes (status codes). 3. **Response Format**: Implement a consistent error response JSON format. 4. **Propagation**: Apply a consistent method for error propagation to higher levels. ### Deliverables - Refactored code with the error system integrated. - Error code dictionary and explanation of the handling flow.