Error Handling
Error responses and exception hierarchy for the vibz.art API and SDKs.
HTTP error responses
All errors follow a consistent JSON format:
{
"error": {
"code": "INVALID_API_KEY",
"message": "API key is invalid or inactive",
"request_id": "req_a1b2c3d4e5f6"
}
}Error codes
| HTTP Status | Code | Description |
|---|---|---|
| 401 | MISSING_API_KEY | No X-API-Key header provided |
| 401 | INVALID_API_KEY | Key is invalid or inactive |
| 422 | VALIDATION_ERROR | Invalid query parameters |
| 429 | RATE_LIMIT_EXCEEDED | Rate limit exceeded (check Retry-After header) |
| 502 | COMPUTE_ERROR | Computation service unavailable |
SDK error handling
Python
from vibzart import Vibzart, AuthenticationError, RateLimitError, APIError
client = Vibzart(api_key="vz_live_...")
try:
result = client.lilavati.panchang(lat=28.61, lng=77.20)
except AuthenticationError:
# 401 — invalid or missing API key
print("Check your API key")
except RateLimitError as e:
# 429 — rate limit exceeded
print(f"Rate limited. Retry after {e.retry_after}s")
except APIError as e:
# Other API errors (422, 502, etc.)
print(f"API error: [{e.status}] {e.code}: {e.detail}")TypeScript
import { Vibzart, AuthenticationError, RateLimitError, APIError } from "@vibzart/sdk";
const client = new Vibzart({ apiKey: "vz_live_..." });
try {
const result = await client.lilavati.panchang({ lat: 28.61, lng: 77.20 });
} catch (e) {
if (e instanceof AuthenticationError) {
console.error("Check your API key");
} else if (e instanceof RateLimitError) {
console.error(`Rate limited. Retry after ${e.retryAfter}s`);
} else if (e instanceof APIError) {
console.error(`API error: [${e.status}] ${e.code}: ${e.detail}`);
}
}Exception hierarchy
| Exception | HTTP Status | Description |
|---|---|---|
AuthenticationError | 401 | Missing or invalid API key |
RateLimitError | 429 | Rate limit exceeded (has retry_after / retryAfter) |
APIError | 4xx/5xx | Other API errors |
APIConnectionError | — | Network timeout or connection failure |
Retries
Both SDKs automatically retry requests that fail with 429, 500, 502, 503, or 504 using exponential backoff with jitter.
- Default: 2 retries (3 total attempts)
- Set
max_retries=0(Python) ormaxRetries: 0(TypeScript) to disable
Response metadata
Every successful response includes metadata alongside the data:
result = client.lilavati.panchang(lat=28.61, lng=77.20)
result.data # Typed response object
result.cached # True if served from cache
result.request_id # Unique ID for debugging (e.g. "req_a1b2c3d4e5f6")
result.rate_limit # RateLimitInfo(limit=100, remaining=99, reset=...)Include the request_id when contacting support.