aethel icon indicating copy to clipboard operation
aethel copied to clipboard

[TASK 1.8] Global Error Handler Middleware

Open aditsuru opened this issue 1 year ago • 1 comments

📋 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.

aditsuru avatar Oct 17 '25 14:10 aditsuru

Working on it...

diamondosas avatar Oct 20 '25 15:10 diamondosas