Workflow Development

Add Error Handling

Workflow for implementing error handling in a feature

errorsresiliencedevelopment
CLAUDE.md

When adding error handling to a feature:

  1. Identify the failure points: network calls, file I/O, parsing, user input, third-party services.
  2. For each failure point, decide: should it retry, fall back, or surface the error to the user?
  3. Create specific error types for distinct failure modes (ValidationError, NotFoundError, TimeoutError).
  4. At the boundary (route handler, UI component), catch errors and translate them into user-friendly messages.
  5. Log the technical details (stack trace, request context) at the catch point — not at every level.
  6. Test each failure mode explicitly. Don’t just test the happy path.

Copy this workflow into your CLAUDE.md or agent config file so your agent follows this process automatically.

get crystl