What problem does it solve?
FastAPI projects often suffer from inconsistent error responses. This skill provides a unified exception hierarchy, standardized error payloads, and centralized handlers to deliver predictable, debuggable API errors.
Core Features & Use Cases
- Custom exception base (AppException) and built-in errors (NotFoundError, ConflictError, ValidationError, ForbiddenError, UnauthorizedError, BadRequestError, DatabaseError, ServiceUnavailableError) for common API failures.
- Standardized error schemas (ErrorResponse and ValidationErrorResponse) to unify error payloads across services.
- Centralized exception registration (register_exception_handlers) to automatically translate exceptions into consistent HTTP responses.
- Works with FastAPI endpoints, repositories, and services to improve maintainability and observability.
Quick Start
Create a NotFoundError in your service and raise it to return a 404 with a consistent payload, then wire up register_exception_handlers(app) in your FastAPI factory.