API Error Handler
中级development最低上下文:16K
Designs and implements comprehensive error handling for APIs. Covers error response formats (RFC 7807 Problem Details), HTTP status code selection, error logging strategies, retry logic, and client-friendly error messages with proper i18n support.
使用场景
- Implementing global error handlers in Express/NestJS/FastAPI
- Designing error response schemas (RFC 7807)
- Creating error code catalogs for APIs
- Building retry-aware error responses with Retry-After headers
- Implementing error boundary patterns in frontend apps
示例提示词
Design an error handling system for my API. Framework: [e.g., NestJS / Express / FastAPI] Requirements: - RFC 7807 Problem Details format - Proper HTTP status codes for each error type - Error codes for client consumption (e.g., AUTH_001) - Structured logging (don't leak internals to clients) - Rate limit errors with Retry-After header - Validation errors with field-level details Please provide: 1. Error response schema/interface 2. Global error handler middleware 3. Custom error classes (NotFound, Validation, Auth, RateLimit) 4. Error code catalog 5. Example usage in a controller
推荐模型
兼容工具
claude-codecursorgithub-copilotkiroany
模态
输入: text, code
→输出: code, text
相关 Skills
作者
OpenModels Community