Cursor CommandsCursor Commands
CategoriesExamples

Add Comprehensive Error Handling

Implement robust error handling including error detection, handling strategies, recovery mechanisms, and improved user experience with clear error messages.

Command Code

# Add Error Handling

Implement comprehensive error handling for the current code. Include:

## Error Detection

- Identify potential failure points and edge cases
- Find unhandled exceptions and error conditions
- Detect missing validation and boundary checks
- Analyze async operations and network calls

## Error Handling Strategy

- Implement try-catch blocks where appropriate
- Add input validation and sanitization
- Create meaningful error messages and logging
- Design graceful degradation for non-critical failures

## Recovery Mechanisms

- Implement retry logic for transient failures
- Add fallback options for service unavailability
- Create circuit breakers for external dependencies
- Design proper error propagation and handling

## User Experience

- Provide clear error messages to users
- Implement proper error status codes for APIs
- Add loading states and error boundaries for UI
- Include helpful suggestions for error resolution

Make the code robust and resilient to failures while maintaining good user
experience.