ApiError
ApiError
Parameters
Examples
try:
model = client.get_model(“nonexistent-model”)
except ApiError as e:
print(f”API Error {e.code}: {e.message}”)
if e.errors:
print(f”Details: {e.errors}”)try:
# API operation
pass
except ApiError as e:
if e.code == 429: # Rate limit
print(“Rate limited, retrying later…”)
time.sleep(60)
elif e.code >= 500: # Server error
print(“Server error, contact support”)
else:
print(f”Client error: {e.message}”)reason : str = 'ApiError'
code : int = 500
Last updated
Was this helpful?