handling-api-errors
FeaturedImplement standardized error handling with proper HTTP status codes and error responses. Use when implementing standardized error handling. Trigger with phrases like "add error handling", "standardize errors", or "implement error responses".
AI & Automation 2,359 stars
334 forks Updated today MIT
Install
Quality Score: 99/100
Stars 20%
Recency 20%
Frontmatter 20%
Documentation 15%
Issue Health 10%
License 10%
Description 5%
Skill Content
# 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
## Instructions
1. Audit existing error handling using Grep to find `try/catch` blocks, error middleware, and exception handlers, identifying inconsistent error response formats across endpoints.
2. Define a standardized error response envelope following RFC 7807: `type` (URI identifying error type), `title` (human-readable summary), `status` (HTTP code), `detail` (specific explanation), and `instance` (request path).
3. Create typed error classes for each error category: `ValidationError` (400), `AuthenticationError` (401), `AuthorizationError` (403), `NotFoundError` (404), `ConflictError` (409), and `RateLimitError` (429).
4. Implement centralized error handling middleware th...
Details
- Author
- jeremylongshore
- Repository
- jeremylongshore/claude-code-plugins-plus-skills
- Created
- 8 months ago
- Last Updated
- today
- Language
- Python
- License
- MIT
Integrates with
Similar Skills
Semantically similar based on skill content — not just same category
AI & Automation Listed
error-handling-architecture
When designing how a system recovers from and reports failures.
5 Updated 3 days ago
KraitDev API & Backend Listed
backend-error-handling
Use when an API needs consistent error responses: catch unhandled errors centrally and return consistent JSON error envelopes.
1 Updated 3 days ago
sarmakska API & Backend Solid
api-error-handling
Implements standardized API error responses with proper status codes, logging, and user-friendly messages. Use when building production APIs, implementing error recovery patterns, or integrating error monitoring services.
168 Updated 4 weeks ago
secondsky