Constructs a new instace of AerospikeError.
Optional
message: stringOptional
command: anyReadonly
codeNumeric status code returned by the server or the client. *
Produces a human-readable error message for the given status code.
statusNamespace contains the full list of possible status codes.
Readonly
commandCommand during which the error occurred.
Optional
Readonly
fileFile name of the C/C++ source file in which the error occurred.
Optional
Readonly
funcC/C++ function name in which the error occurred.
Optional
Readonly
inIt 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.
Optional
Readonly
lineLine number in the C/C++ source file in which the error occurred.
Optional
stackStatic
Optional
prepareOptional override for formatting stack traces
Static
stackThe Client instance associated with this error, if any.
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()
})
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.
Example: Expected output: "Error: 127.0.0.1:3000 Record does not exist in database. May be returned by read, or write with policy Aerospike.policy.exists.UPDATE [2]"