Interface DataAPIErrorDescriptor

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.

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

Example

{
  errorCode: 'DOCUMENT_ALREADY_EXISTS',
  message: "Failed to insert document with _id 'id3': Document already exists with the given _id",
  attributes: {},
}

Field

errorCode - A string code representing the exact error

Field

message - A human-readable message describing the error

Field

attributes - A map of additional attributes returned by the API. Often empty

interface DataAPIErrorDescriptor {
    attributes?: Record<string, any>;
    errorCode?: string;
    message?: string;
}

Properties

attributes?: Record<string, any>

A map of additional attributes that may be useful for debugging or logging returned by the API. Not guaranteed to be non-empty. Probably more often empty than not.

errorCode?: string

A string code representing the exact error

message?: string

A human-readable message describing the error