aethel
aethel copied to clipboard
[TASK 1.8] Global Error Handler Middleware
📋 Task Description
Create the centralized error handling middleware that catches all errors and formats responses.
🎯 Deliverables
Files to create/modify:
src/middlewares/errorHandler.middleware.ts
📚 Reference Documentation
Refer to 00-Core-Architecture-and-Setup.md - Section 4 (Global Error Handler)
✅ Acceptance Criteria
- [ ] Handles ApiError instances with their statusCode and message
- [ ] Handles OpenAPI validation errors
- [ ] Defaults to 500 for unexpected errors
- [ ] Logs errors appropriately
- [ ] Returns consistent JSON response format
⚠️ Important Guidelines
- Read CONTRIBUTING.md before starting
- PR must address only this issue - multi-issue PRs will be rejected
- Implement only what is specified - do not make assumptions or add extra features
- Follow the exact patterns and structure defined in the reference documentation
💬 Questions?
Ask in the Discord server or comment below before starting work.
Working on it...