TDXApiError

TDXApiError

The TDX api supplies detailed error information depending on the context of the call. In some instances, e.g. attempting to retrieve a resource that does not exist, the error will be a simple NotFound string message. In other cases, e.g. attempting to update 100 documents in a single call, the error will supply details for each document update that failed, such as the primary key of the document and the reason for the failure.

Constructor

new TDXApiError()

Source:
Examples

`failure` for simple query error

const failure = {
  code: "NotFound",
  message: "resource not found: KDiEI3k_"
};

`failure` for complex data update error

const failure = {
 code: "BadRequestError",
 message: [
   {
     key: {id: "foo"},
     error: {
       message: "document not found matching key 'foo'"
     }
   },
   {
     key: {id: "bar"},
     error: {
       message: "'hello' is not a valid enum value",
       name: "ValidatorError",
       kind: "enum"
       path: "value"
     }
   }
 ]
};

Members

code :number

Source:

The HTTP response status code, e.g. 401.

Type:
  • number

failure :FailureObject

Source:

An object containing the error information as received from the TDX

Type:

from :string

Source:

Usually the name of the API call that originated the error, e.g. updateData

Type:
  • string

message :string

Source:
Deprecated:
  • This is included for legacy reasons and may be removed in a future release.

A string-encoded form of the error, essentially a JSON stringified copy of the entire error object.

Type:
  • string

name :string

Source:

"TDXApiError", indicating the error originated from this library.

Type:
  • string

stack :string

Source:

The stack trace

Type:
  • string