Python SDK - Errors#
Every failure raises a RafikiDBError with structured fields.
Fields#
| Field | Type | Example |
|---|---|---|
message | str | "invalid credentials" |
status | int | 401 |
code | str | "unauthorized" |
errors | list[str] | ["Email is required"] |
code is derived from the HTTP status: unauthorized, forbidden,
not_found, conflict, invalid_input, quota_exceeded, internal_error.
Handling#
from rafikidb import RafikiDBError
try:
db.from_("profiles").insert({})
except RafikiDBError as error:
print(error.status, error.code, error.errors)
# network failures arrive with status 0
PythonCommon codes#
| Code | HTTP | Meaning |
|---|---|---|
invalid_input | 400 | Malformed body, missing/invalid field |
unauthorized | 401 | Missing or invalid key / JWT |
forbidden | 403 | Authenticated but not allowed (scope, RLS) |
not_found | 404 | Resource or table does not exist |
conflict | 409 | Duplicate email/phone, conflicting state |
quota_exceeded | 429 | Plan request limit reached |
internal_error | 500 | Server error |
See Error codes for the REST reference.