API error handling
easy 24 minGood error handling tells the caller what went wrong, why, and what to do next, in one format for the whole API.
Where it shows up
The same pattern appears across everyday software.
Stripe
Errors carry a type, a code, the parameter at fault and a link to documentation, so programs branch on the code and people follow the link.
Google APIs
AIP-193 asks for a machine-readable reason, the domain and metadata in an ErrorInfo detail, separate from the message for people.
GitHub
Rate-limited answers carry retry-after or reset headers, and clients are asked to wait instead of repeating. Validation failures list the resource, field and code.
gRPC
The documentation says when to retry: UNAVAILABLE for the same call, ABORTED at a higher level, FAILED_PRECONDITION not before the state is fixed.
W3C Trace Context
The traceparent header is a standard way to carry one trace id across services and vendors.
Log-in pages
OWASP advises the same generic answer for unknown user and wrong password, so that an error cannot be used to find accounts.