m13-domain-error

Installation
Summary

Design error handling by categorizing who handles each error and how they recover.

  • Distinguish between user-facing errors (actionable messages), internal errors (debug details), system errors (monitoring), and transient vs. permanent failures to determine recovery strategy
  • Use typed error enums with thiserror and implement is_retryable() checks to enable appropriate handling patterns
  • Apply recovery strategies: retry with exponential backoff for transient failures, fallback values for degraded modes, circuit breakers for cascading failures, and timeouts for slow operations
  • Include error context via .context() for debugging and structured logging with request IDs; avoid exposing internal details to end users
SKILL.md

Domain Error Strategy

Layer 2: Design Choices

Core Question

Who needs to handle this error, and how should they recover?

Before designing error types:

  • Is this user-facing or internal?
  • Is recovery possible?
  • What context is needed for debugging?

Error Categorization

Error Type Audience Recovery Example
Related skills

More from zhanghandong/rust-skills

Installs
659
GitHub Stars
1.1K
First Seen
Jan 20, 2026