Error Handling
Separate validation problems, authentication failures, rate limits, empty results, and transient outages so each gets the right response.
Failure classes
Do not retry every error
Permanent errors need request or credential changes. Temporary errors can be retried with backoff.
Fail closed on authentication
If a key is missing or unauthorized, stop the workflow and alert an operator instead of retrying the same key.
Show graceful fallbacks
Use cached data, partial results, empty states, or a clear retry state in user-facing applications.