This is the base class for all errors returned by the driver. NoSQLError extends JavaScript Error class and all other errors used by the driver extend NoSQLError. Note that you don't create these error objects explicitly, but the driver returns errors in the following ways:

  • For synchronous APIs the error is thrown as an exception
  • For asynchronous APIs, which is most of the APIs in NoSQLClient class, the error is the result of the rejection of Promise returned by the API. In async function, you can use try...catch to handle these errors as if they were exceptions.

Each error contains ErrorCode which can be used in the application logic to take different actions upon different kinds of errors. In addition, an error may have an optional cause, which is another error that caused this error. The cause is typically also instance of NoSQLError or its subclass, but sometimes may not be. E.g. if an authorization error is caused by invalid JSON response, the cause would be instance of SyntaxError.

In addition, each error has an optional operation object which describes the operation that caused the error, including the API and its arguments, see Operation. Not all errors have operation available.

Most errors returned from the server result in NoSQLError, but for other cases specialized subclasses are used such as NoSQLArgumentError, NoSQLServiceError, NoSQLNetworkError, NoSQLAuthorizationError and others.

See

Working With Tables

Hierarchy

Properties

cause?: Error

An error that caused this error. In many cases it is also instance of NoSQLError and may itself have a cause. You could iterate through the chain of causes like this:

for(let cause = err.cause; cause; cause = cause.cause) {...

If this error does not have a cause, the value of this property is undefined.

errorCode: ErrorCode

ErrorCode of this error.

message: string
name: string
operation?: Config | Operation

Operation that resulted in this error. Operation object contains the API and its arguments including the options used. Operation object may not always be available, in which case the value of this property is undefined.

If this error happened during creation of new NoSQLClient then instead of Operation this property contains Config used to create NoSQLClient instance.

See

retryable?: boolean

Indicates whether this error is retryable.

APIs that result in retryable errors are automatically retried by the driver's default RetryHandler. Default retry handler can be customized by properties in RetryConfig. Alternatively, a custom RetryHandler can be set as handler.

If necessary, APIs that result in retryable errors may also be explicitly retried by the application.

See

RetryConfig

stack?: string
prepareStackTrace?: ((err: Error, stackTraces: CallSite[]) => any)

Type declaration

stackTraceLimit: number

Methods

  • Create .stack property on a target object

    Parameters

    • targetObject: Object
    • Optional constructorOpt: Function

    Returns void

Generated using TypeDoc