handling-api-errors
Installation
SKILL.md
Handling API Errors
Overview
Implement standardized API error handling with RFC 7807 Problem Details responses, centralized error middleware, typed error classes, and environment-aware stack trace exposure. Convert framework exceptions, validation failures, database errors, and upstream service failures into consistent, machine-readable error responses with appropriate HTTP status codes.
Prerequisites
- Web framework with middleware/error handler support (Express, FastAPI, Spring Boot, Gin)
- Structured logging library for error event recording with correlation IDs
- Error monitoring service: Sentry, Bugsnag, or Rollbar for production error tracking
- RFC 7807 Problem Details specification for response format guidance
- API documentation listing all possible error codes and their meanings