Reference
Errors
Tuerss uses conventional HTTP status codes to indicate success or failure. Codes in the 2xx range mean success, 4xx codes indicate a problem with your request, and 5xx codes indicate a problem on our servers. Every error response returns a structured JSON body.
Error shape
Each error includes a machine-readable type, a human message, and a request ID for support.
422 Unprocessable Entity
{
"error": {
"type": "validation_error",
"code": 422,
"message": "The field 'email' must be a valid email address.",
"param": "email",
"request_id": "req_9fK2mQ4xVt"
}
}Status codes
| Status | Type | Meaning |
|---|---|---|
| 400 | bad_request | The request was malformed or missing required fields. |
| 401 | unauthorized | No valid API key was provided in the request. |
| 403 | forbidden | The API key does not have access to this resource. |
| 404 | not_found | The requested resource does not exist. |
| 409 | conflict | The request conflicts with the current state. |
| 422 | validation_error | One or more fields failed validation. |
| 429 | rate_limited | You have exceeded your plan rate limit. |
| 500 | internal_error | Something went wrong on our end. |
| 503 | service_unavailable | The service is temporarily offline. |
Handling errors
Wrap calls in a try/catch. The SDK throws typed errors you can branch on.
error-handling.js
try {
const res = await client.geocode.lookup({ address: "1 Infinite Loop" })
} catch (err) {
if (err.code === 429) {
// back off and retry after the Retry-After header
await sleep(err.retryAfter * 1000)
} else {
console.error(err.type, err.message, err.requestId)
}
}