---
title: "Error handling"
description: "Handle Aerospike Java client runtime exceptions with detailed error type explanations and implementation examples."
---

# Error handling

> For the complete documentation index see: [llms.txt](https://aerospike.com/docs/llms.txt)
> 
> All documentation pages available in markdown.

The java client can throw the following runtime exceptions:

| Exception | Description |
| --- | --- |
| AerospikeException | Base exception. A more specific error code can be obtained by getResultCode(). [View Result Codes](https://github.com/aerospike/aerospike-client-java/blob/master/client/src/com/aerospike/client/ResultCode.java) |
| AerospikeException.Timeout | Command has timed out. |
| AerospikeException.Serialize | Error using java or messagepack encoding/decoding. |
| AerospikeException.Parse | Error parsing server response. |
| AerospikeException.Connection | Error establishing connection to server node. |
| AerospikeException.InvalidNode | The chosen node is not active or a namespace is removed while the client is active. |
| AerospikeException.ScanTerminated | Scan was terminated prematurely. |
| AerospikeException.QueryTerminated | Query was terminated prematurely. |
| AerospikeException.CommandRejected | Async command was rejected because the maximum concurrent database commands have been exceeded. |

Here is example code that handles an AerospikeException.

```java
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();

}
```