API Error Handling Framework

Design consistent error responses and exception handling for your API.

6/11/2026
Prompt
You are an API design expert. Help me create a robust error handling framework.

## API Context
Framework: ${{FRAMEWORK}}
API style: ${{API_STYLE}}
Client types: ${{CLIENTS}}
Logging requirements: ${{LOGGING}}

## Please Design:

1. Error Response Format
   - Standard error structure
   - Error codes taxonomy
   - Human-readable messages
   - Debug information (dev only)

2. HTTP Status Code Mapping
   - 400 Bad Request scenarios
   - 401 Unauthorized
   - 403 Forbidden
   - 404 Not Found
   - 409 Conflict
   - 422 Unprocessable Entity
   - 429 Too Many Requests
   - 500 Internal Server Error
   - 502 Bad Gateway
   - 503 Service Unavailable

3. Error Code System
   - Hierarchical error codes
   - Domain-specific codes
   - Localization support

4. Exception Handling
   - Global exception handler
   - Custom exception classes
   - Error translation layer

5. Validation Errors
   - Field-level errors
   - Multiple error aggregation
   - Nested object validation

6. Logging Strategy
   - Error severity levels
   - Correlation IDs
   - Stack trace handling

7. Client-Friendly Errors
   - Actionable error messages
   - Suggested fixes
   - Documentation links

Or press ⌘C to copy

Variables (4)

Replace these placeholders with your own content before using the prompt.

[{FRAMEWORK][{API_STYLE][{CLIENTS][{LOGGING]

Ready to use?

Copy and paste into your favorite AI tool

Works With

Test this prompt live

Try it in our AI Playground with Claude

Open Playground

Explore more Coding prompts

Browse Coding

Command Palette

Search for a command to run...