Description:
Add a standalone global HTTP exception filter that returns consistent, structured error responses across the entire API.
Tasks:
- Create
src/common/filters/http-exception.filter.ts implementing ExceptionFilter
- Catch all
HttpException and generic Error instances
- Return a uniform JSON shape:
{ statusCode, message, error, timestamp, path }
- Register the filter globally in
main.ts
- Map unhandled
Error instances to 500 Internal Server Error without leaking stack traces in production (NODE_ENV=production)
Acceptance Criteria:
- All API error responses follow the defined JSON shape
- Stack traces are hidden in production but logged server-side
- Validation errors from the global
ValidationPipe are also formatted by this filter