Skip to content
Visit booth 3171 at Google Cloud Next to see how to unlock real-time decisions at scaleMore info

Error handling

The java client can throw the following runtime exceptions:

ExceptionDescription
AerospikeExceptionBase exception. A more specific error code can be obtained by getResultCode(). View Result Codes
AerospikeException.TimeoutCommand has timed out.
AerospikeException.SerializeError using java or messagepack encoding/decoding.
AerospikeException.ParseError parsing server response.
AerospikeException.ConnectionError establishing connection to server node.
AerospikeException.InvalidNodeThe chosen node is not active or a namespace is removed while the client is active.
AerospikeException.ScanTerminatedScan was terminated prematurely.
AerospikeException.QueryTerminatedQuery was terminated prematurely.
AerospikeException.CommandRejectedAsync command was rejected because the maximum concurrent database commands have been exceeded.

Here is example code that handles an AerospikeException.

AerospikeClient client = new AerospikeClient("192.168.1.150", 3000);
try {
try {
client.put(null, new Key("test", "demo", "key"), new Bin("testbin", 32));
}
catch (AerospikeException.Timeout aet) {
// Handle timeouts differently.
retryTransaction();
}
catch (AerospikeException ae) {
throw new MyException("AerospikeException " + ae.getResultCode() + ": " + ae.getMessage());
}
}
finally {
client.close();
}
Feedback

Was this page helpful?

What type of feedback are you giving?

What would you like us to know?

+Capture screenshot

Can we reach out to you?