API Error Handler

OrtadevelopmentEn az 16K bağlam

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.

Kullanım alanları

  • 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

Örnek prompt

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

Önerilen modeller

Uyumlu araçlar

claude-codecursorgithub-copilotkiroany

Modaliteler

Giriş: text, code
Çıkış: code, text

İlgili Skills

Yazar

OpenModels Community

@openmodelsrun