Designs comprehensive error handling and logging strategies with classification, structured logging, and monitoring.
You are a reliability engineer who designs robust error handling systems. Design an error handling and logging strategy for this application.
Application type: [WEB APP / API / MICROSERVICE / CLI]
Language/Framework: [STACK]
Current error handling: [DESCRIBE OR PASTE EXAMPLES]
Logging infrastructure: [CLOUDWATCH / DATADOG / ELK / OTHER]
Environments: [DEV / STAGING / PROD]
Design:
**Error Classification**
```
Operational Errors (expected, recoverable):
- Network timeouts
- Validation failures
- Rate limits
Programmer Errors (bugs):
- Type errors
- Null references
- Logic errors
```
**Error Response Format**
```json
{
"error": {
"code": "ERROR_CODE",
"message": "User-friendly message",
"details": {},
"requestId": "uuid",
"documentation": "url"
}
}
```
**Error Codes Catalog**
| Code | HTTP Status | Description | User Message |
|------|-------------|-------------|-------------|
**Custom Error Classes**
```[language]
class AppError extends Error {
// Implementation with proper inheritance
}
```
**Logging Strategy**
Log Levels:
- ERROR: [When to use]
- WARN: [When to use]
- INFO: [When to use]
- DEBUG: [When to use]
Structured Log Format:
```json
{
"timestamp": "",
"level": "",
"message": "",
"context": {},
"requestId": ""
}
```
**Sensitive Data Handling**
- Fields to redact
- Redaction patterns
- PII handling
**Monitoring & Alerting**
- Error rate thresholds
- Alert conditions
- Runbook triggers
- Dashboard requirements
**Recovery Patterns**
- Retry strategies
- Circuit breakers
- Fallbacks
- Graceful degradationYou are a reliability engineer who designs robust error handling systems. Design an error handling and logging strategy for this application.
Application type: [WEB APP / API / MICROSERVICE / CLI]
Language/Framework: [STACK]
Current error handling: [DESCRIBE OR PASTE EXAMPLES]
Logging infrastructure: [CLOUDWATCH / DATADOG / ELK / OTHER]
Environments: [DEV / STAGING / PROD]
Design:
**Error Classification**
```
Operational Errors (expected, recoverable):
- Network timeouts
- Validation failures
- Rate limits
Programmer Errors (bugs):
- Type errors
- Null references
- Logic errors
```
**Error Response Format**
```json
{
"error": {
"code": "ERROR_CODE",
"message": "User-friendly message",
"details": {},
"requestId": "uuid",
"documentation": "url"
}
}
```
**Error Codes Catalog**
| Code | HTTP Status | Description | User Message |
|------|-------------|-------------|-------------|
**Custom Error Classes**
```[language]
class AppError extends Error {
// Implementation with proper inheritance
}
```
**Logging Strategy**
Log Levels:
- ERROR: [When to use]
- WARN: [When to use]
- INFO: [When to use]
- DEBUG: [When to use]
Structured Log Format:
```json
{
"timestamp": "",
"level": "",
"message": "",
"context": {},
"requestId": ""
}
```
**Sensitive Data Handling**
- Fields to redact
- Redaction patterns
- PII handling
**Monitoring & Alerting**
- Error rate thresholds
- Alert conditions
- Runbook triggers
- Dashboard requirements
**Recovery Patterns**
- Retry strategies
- Circuit breakers
- Fallbacks
- Graceful degradationThis prompt is released under CC0 (Public Domain). You are free to use it for any purpose without attribution.
Explore similar prompts based on category and tags
Analyzes complex error stack traces to identify root causes and provide specific code fixes.
Creates comprehensive Architecture Decision Records with options analysis, decision matrices, and consequence documentation.
Conducts thorough code reviews covering security, performance, maintainability, and best practices with specific fix suggestions.
Identifies security vulnerabilities with fixes, OWASP analysis, and comprehensive hardening recommendations.