What problem does it solve?
Inconsistent error handling leads to unpredictable application behavior, difficult debugging, and a poor user experience. This Skill provides a standardized approach to error management, ensuring clarity and consistency across your application.
Core Features & Use Cases
- Consistent Exception Design: Create custom exceptions with defined error codes and appropriate HTTP statuses, making errors predictable and easy to manage.
- Centralized Error Management: Implement NestJS exception filters for uniform error responses, reducing boilerplate and ensuring a consistent API contract.
- Fail-Fast Validation: Integrate early error detection in use cases and validators, preventing invalid states and improving application reliability.
- Use Case: When a user attempts to access a non-existent resource, this Skill ensures the system consistently throws a specific exception (e.g.,
ArticleNotFoundException) with a 404 Not Found status and a user-friendly message, rather than a generic server error.
Quick Start
Help me create a new custom exception class for a 'ProductNotFound' error, ensuring it extends CustomException and uses HttpStatus.NOT_FOUND with a unique error code.