Class AerospikeError

Error raised by the client when execution of a database command fails. This may be either due to an error status code returned by the server, or caused by an error condition that occured on the client side.

const Aerospike = require('aerospike')

// INSERT HOSTNAME AND PORT NUMBER OF AEROSPIKE SERVER NODE HERE!
var config = {
hosts: '192.168.33.10:3000',
// Timeouts disabled, latency dependent on server location. Configure as needed.
policies: {
read : new Aerospike.ReadPolicy({socketTimeout : 0, totalTimeout : 0}),
write : new Aerospike.WritePolicy({socketTimeout : 0, totalTimeout : 0})
}
}

let key = new Aerospike.Key('test', 'key', 'does_not_exist')
Aerospike.connect()
.then(client => {
client.get(key)
.then(record => console.info(record))
.catch(error => console.error(`Error: ${error.message} [${error.code}]`))
.then(() => client.close())
})

Hierarchy

  • Error
    • AerospikeError

Constructors

Properties

code:
    | 0
    | 1
    | 2
    | 3
    | 4
    | 5
    | ((code: 0 | 1 | 2 | 3 | 4 | 5 | ((code: 0 | 1 | 2 | 3 | 4 | 5 | typeof getMessage | 19 | -19 | 18 | -18 | 17 | -17 | 16 | -16 | 15 | -15 | 14 | -14 | 13 | -13 | 12 | -12 | 11 | -11 | 10 | -10 | 9 | -9 | ... 70 more ... | 1302) => string) | ... 92 more ... | 1302) => string)
    | 19
    | -19
    | 18
    | -18
    | 17
    | -17
    | 16
    | -16
    | 15
    | -15
    | 14
    | -14
    | 13
    | -13
    | 12
    | -12
    | 11
    | -11
    | 10
    | -10
    | 9
    | -9
    | 8
    | -8
    | 7
    | -7
    | 6
    | -6
    | -5
    | -4
    | -3
    | -2
    | -1
    | 20
    | 21
    | 22
    | 23
    | 24
    | 25
    | 26
    | 27
    | 28
    | 32
    | 50
    | 51
    | 52
    | 53
    | 54
    | 55
    | 56
    | 60
    | 61
    | 62
    | 63
    | 64
    | 65
    | 66
    | 70
    | 71
    | 72
    | 73
    | 74
    | 75
    | 80
    | 81
    | 82
    | 83
    | 100
    | 120
    | 121
    | 122
    | 123
    | 124
    | 125
    | 126
    | 127
    | 150
    | 151
    | 152
    | 160
    | 200
    | 201
    | 202
    | 203
    | 204
    | 205
    | 206
    | 210
    | 211
    | 212
    | 213
    | 1301
    | 1302

Numeric status code returned by the server or the client. *

Type declaration

    • (code): string
    • Produces a human-readable error message for the given status code.

      Parameters

      • code: 0 | 1 | 2 | 3 | 4 | 5 | ((code: 0 | 1 | 2 | 3 | 4 | 5 | typeof getMessage | 19 | -19 | 18 | -18 | 17 | -17 | 16 | -16 | 15 | -15 | 14 | -14 | 13 | -13 | 12 | -12 | 11 | -11 | 10 | -10 | 9 | -9 | ... 70 more ... | 1302) => string) | ... 92 more ... | 1302

      Returns string

statusNamespace contains the full list of possible status codes.

command: any

Command during which the error occurred.

file?: null | string

File name of the C/C++ source file in which the error occurred.

func?: null | string

C/C++ function name in which the error occurred.

inDoubt?: boolean

It is possible that a write command completed even though the client returned this error. This may be the case when a client error occurs (like timeout) after the command was sent to the server.

line?: null | number

Line number in the C/C++ source file in which the error occurred.

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

Optional override for formatting stack traces

stackTraceLimit: number

Accessors

  • get client(): void | Client
  • The Client instance associated with this error, if any.

    Returns void | Client

    v3.7.0

    const Aerospike = require('aerospike')

    // INSERT HOSTNAME AND PORT NUMBER OF AEROSPIKE SERVER NODE HERE!
    var config = {
    hosts: '192.168.33.10:3000',
    // Timeouts disabled, latency dependent on server location. Configure as needed.
    policies: {
    read : new Aerospike.ReadPolicy({socketTimeout : 0, totalTimeout : 0}),
    write : new Aerospike.WritePolicy({socketTimeout : 0, totalTimeout : 0})
    }
    }

    Aerospike.connect(config).then(async client => {
    await client.put(new Aerospike.Key('demo', 'test', 'foo'), { 'foo': 'bar' })
    client.close()
    }).catch(error => {
    console.error('Error: %s [%i]', error.message, error.code)
    if (error.client) error.client.close()
    })

Methods

  • Indicates whether the error originated on the database server.

    Returns boolean

    true if the server raised the error, false otherwise.

  • Create .stack property on a target object

    Parameters

    • targetObject: object
    • OptionalconstructorOpt: Function

    Returns void

MMNEPVFCICPMFPCPTTAAATR