Error codes
Errors have this shape over HTTP, and become a DriveDBError with the same code, message,
details and status in the SDK:
{ "error": { "code": "DuplicateKey", "message": "Another document already has email: \"mei@example.com\".", "details": { "field": "email", "value": "mei@example.com" } }}| Code | Status | Meaning and what to do |
|---|---|---|
BadRequest |
400 | The request body doesn’t match the action (details.issues lists the problems). |
ValidationError |
400 | A value doesn’t fit its field’s type (details.field). Fix the data. |
BadValue |
400 | An invalid filter, update or pipeline (unknown operator, $out…). |
ImmutableField |
400 | Tried to change _id, _createdAt or _updatedAt. |
InvalidName |
400 | A collection or field name isn’t a valid API name. |
Unauthorized |
401 | Missing, mistyped, revoked or expired connection string, or Google access was removed. Create a new connection string in the app. |
ReadOnlyKey |
403 | A read-only connection string tried to write. |
ReadOnly |
403 | You can only view this database (shared with view access). |
NamespaceNotFound |
404 | The collection doesn’t exist (for getSchema, watch…). |
UnknownAction |
404 | No such action, or a wrong URL. |
DuplicateKey |
409 | A unique field already has this value (details.field). |
PayloadTooLarge |
413 | The request body is over 1 MB. Split it into smaller batches. |
RateLimited |
429 | Too many requests. Wait Retry-After seconds (the SDK does). |
DatabaseUnavailable |
503 | The file is in the trash (details.problem: "trashed"), deleted (missing), unreadable (damaged), restored to an older version (restoredElsewhere), or access was removed (noAccess). Fix it in the app. |
DriveUnavailable |
503 | Google Drive is briefly unreachable. Retry (the SDK does). |
DriveFull |
507 | The owner’s Google Drive storage is full, so writes can’t be saved. Free up space. |
InternalError |
500 | Something went wrong on our side. Retry later. |
The SDK adds three codes of its own:
| Code | Meaning |
|---|---|
InvalidConnectionString |
The string passed to new DriveDB() isn’t a connection string. |
NetworkError |
The server couldn’t be reached. |
Timeout |
No answer in time (timeoutMs, 30 s by default). |
Made by Faeiz Furqan