Interface DataAPIErrorDescriptor

Overview

An object representing a single "soft" (2XX) error returned from the Data API, typically with an error code and a human-readable message. An API request may return with an HTTP 200 success error code, but contain a nonzero amount of these, such as for duplicate inserts, or invalid IDs.

Disclaimer

This is not used for "hard" (4XX, 5XX, timeout) errors, which are rarer and would be thrown directly by the underlying code.

Example

{
family: 'REQUEST',
scope: 'DOCUMENT',
errorCode: 'MISSING_PRIMARY_KEY_COLUMNS',
title: 'Primary key columns missing'
id: 'f785ebb9-a375-4d96-842f-31e23a10a1a5',
message: `
All primary key columns must be provided when inserting a document into a table.

The table default_keyspace.test_table defines the primary key columns:
text(text), int(int).

The command included values for primary key columns: [None].
The command did not include values for primary key columns: int(int), text(text).

Resend the command including the missing primary key columns.
`,
}

Field

id - A unique identifier for this instance of the error.

Field

family - Informs if the error was due to their request or server side processing.

Field

scope - Informs what area of the request failed.

Field

errorCode - Informs the exact error that occurred.

Field

title - A short, human-readable summary of the error.

Field

message - A longer human-readable description of the error.

interface DataAPIErrorDescriptor {
    errorCode: string;
    family: LitUnion<"REQUEST" | "SERVER">;
    id: string;
    message: string;
    scope?: string;
    title: string;
}

Properties

errorCode: string

Leaf level of the hierarchy of errors.

Informs the exact error that occurred.

Error codes will be unique within the combination of family and scope, at the very least.

  • (They will most likely be unique across the entire API).

Will be something like 'DOCUMENT_ALREADY_EXISTS', 'MISSING_PRIMARY_KEY_COLUMNS', etc.

family: LitUnion<"REQUEST" | "SERVER">

Top level of the hierarchy of errors.

Informs if the error was due to their request or server side processing.

Expected to only ever be 'REQUEST' | 'SERVER', but left open for unlikely future expansion.

id: string

A unique UUID V4 identifier for this instance of the error.

message: string

A longer human-readable description of the error that contains information specific to the error.

This may contain newlines and other formatting characters.

scope?: string

Optional, second level of the hierarchy of errors.

Informs what area of the request failed.

Will be something like 'DATABASE', 'EMBEDDING', 'FILTER', 'DOCUMENT', 'AUTHORIZATION', etc.

title: string

A short, human-readable summary of the error.

The title will NOT change for between instances of the same error code.

(that is, every instance of the MULTIPLE_ID_FILTER error returned by the API will have the same title).

Will be something like

  • 'Primary key columns missing'
  • 'Document already exists with the given _id'
  • etc.