Dart SDK - Errors#

Every failure throws a RafikiDBError.

Fields#

FieldTypeExample
messageString"invalid credentials"
statusint401
codeRafikiDBErrorCodeRafikiDBErrorCode.unauthorized
errorsList<String>["Email is required"]

RafikiDBErrorCode is derived from the HTTP status and is one of: invalidInput, unauthorized, forbidden, notFound, conflict, quotaExceeded, internalError.

Handling#

try {
  await db.from('profiles').insert({});
} on RafikiDBError catch (error) {
  print('${error.status} ${error.code.name}: $error.message');
  print(error.errors);
}
DART

Common codes#

CodeHTTPMeaning
invalidInput400Malformed body, missing/invalid field
unauthorized401Missing or invalid key / JWT
forbidden403Authenticated but not allowed (scope, RLS)
notFound404Resource or table does not exist
conflict409Duplicate email/phone, conflicting state
quotaExceeded429Plan request limit reached
internalError500Server error

See Error codes for the REST reference.