About Filters
Exception filters for error handling
Browse the snippets below to find the filters implementation you need for your NestJS project.
All Filters Snippets
HTTP Exception Filter
Global HTTP exception handling
- Structured error response
- Request ID included
- Status-based logging
All Exceptions Filter
Catch-all exception filter
- Catches all errors
- Sensitive data sanitization
- Production-safe messages
Validation Filter
Validation exception handling
- Field-level errors
- Custom ValidationException
- Helper functions
Prisma Exception Filter
Prisma database error handling
- Unique constraint errors
- Not found errors
- Foreign key errors
How to Use
Install any snippet using the Hanma CLI:
npx hanma add --framework nest
For example, to install the first snippet:
npx hanma add http-exception-filter --framework nest