Guides
Errors
Handle validation, availability and rate-limit responses.
Error envelope
{
"error": {
"code": "INVALID_QUERY",
"message": "One or more query parameters are invalid.",
"requestId": "request-id"
}
}| HTTP status | Code | Meaning |
|---|---|---|
| 400 | INVALID_QUERY | A path or query value failed validation. |
| 404 | NOT_FOUND | The route or public record does not exist. |
| 405 | METHOD_NOT_ALLOWED | Only GET and HEAD are supported. |
| 429 | RATE_LIMITED | The client exceeded the fixed request window. |
| 503 | DATA_UNAVAILABLE | The public read layer cannot provide the requested data. |
Handling pattern
Treat errors as data. Keep requestId when reporting a problem, show a retry affordance for temporary availability failures, and do not retry malformed 4xx requests automatically.
const response = await fetch(url);
if (!response.ok) {
const body = await response.json();
console.warn(body.error.code, body.error.requestId);
}