Description: Error responses are not consistently formatted across the application. Implement a global exception filter that standardises all error payloads including validation errors, auth errors, and unexpected exceptions.
Tasks:
- Create a
GlobalExceptionFilter that implements ExceptionFilter
- Standardise error response shape:
{ statusCode, message, error, timestamp, path }
- Handle
HttpException, QueryFailedError (TypeORM), and unknown errors distinctly
- Register the filter globally in
main.ts
- Write unit tests covering each error category
Acceptance Criteria:
- All error responses follow the same JSON structure
- Database errors do not leak raw SQL messages to clients
- Unexpected errors return 500 with a safe generic message
ETA: 1 day
Description: Error responses are not consistently formatted across the application. Implement a global exception filter that standardises all error payloads including validation errors, auth errors, and unexpected exceptions.
Tasks:
GlobalExceptionFilterthat implementsExceptionFilter{ statusCode, message, error, timestamp, path }HttpException,QueryFailedError(TypeORM), and unknown errors distinctlymain.tsAcceptance Criteria:
ETA: 1 day