Qikuyueser.com

Enumerate Failure Modes for an API

Added 2026-11-01

Timeouts, partial success, duplicate submissions: define what callers will actually hit.

Here is an API definition. Do: 1) list five failure modes — timeout, partial success, duplicate submission, expired permission, downstream unavailable; 2) for each, what the caller sees and which status or error code the server should return; 3) the correct caller strategy for each — retry, give up, reconcile, degrade; 4) which one developers most often miss and only discover in production; 5) one sentence you could put in the docs. Do not just write "returns 500".
Site original

Chinese original

Open in ChatGPT
How to use

接口文档里没写的失败,线上都会出现。

Try tweaking it

  • Have it restate requirements and constraints before writing code.
  • Ask for the smallest change plus a rollback path, not a full-file rewrite.

What you should get

  • A minimal, runnable change with copy-ready code
  • Impact list: which files and call sites must follow

Common mistakes

  • Asking it to touch ten files at once, then losing track of what broke what.
  • Pasting only the error, with no code or version, and getting an unfixable answer.

How to check the output

  • The change runs, can be rolled back, and touches nothing unrelated.
  • Edge cases (empty, oversized, concurrent) are covered or explained.

Where it works

  • Good for: having it restate requirements and constraints, then propose the smallest runnable change.
  • Watch out: include versions and a minimal reproduction with the error, or the fix may look plausible but not fit.

More in this topic