Workflow Testing

Test Error Handling

Workflow for verifying error paths are handled correctly

testingerrorsresilience
CLAUDE.md

When testing error handling:

  1. Identify every error path in the code: failed API calls, invalid input, missing data, timeouts, permission denied.
  2. For each error path, write a test that triggers the error condition.
  3. Verify the error message is correct, specific, and helpful.
  4. Verify the error status code is appropriate (400, 401, 403, 404, 500).
  5. Verify side effects don’t occur on error: partial writes are rolled back, files aren’t left in a broken state.
  6. Verify the calling code receives the error in a usable format (structured error object, not a string).
  7. Test that errors don’t leak sensitive information: no stack traces, internal paths, or credentials in user-facing errors.

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

get crystl