What problem does it solve?
This Skill addresses the challenge of managing failures in software by providing a standardized approach to defining, propagating, and handling errors, ensuring applications remain stable and informative.
Core Features & Use Cases
- Custom Error Definitions: Create domain-specific error types using Swift's
Error and LocalizedError protocols.
- Contextual Error Information: Utilize associated values in enums to provide detailed context about failures.
- Propagation Strategies: Implement explicit error propagation and avoid silent failures.
- Recovery Mechanisms: Design retry logic for transient errors and ensure graceful degradation.
- Structured Logging: Log errors with comprehensive context for easier debugging.
- Use Case: When a network request fails, this skill helps define a
NetworkError enum with associated statusCode and errorMessage, ensuring the failure is logged with full context and potentially retried.
Quick Start
Define custom error types for your application using Swift enums conforming to the Error protocol.