LindormTSDB SDK throws two types of exceptions: ClientException for client-side errors and LindormTSDBException for server-side errors. Both extend RuntimeException.
ClientException
ClientException is thrown when the client fails to send a request or transmit data to LindormTSDB — for example, when the network is disconnected.
LindormTSDBException
LindormTSDBException is thrown when the server returns an error response. It carries the following fields to help you identify and handle the problem.
Field | Description |
| Error code returned by LindormTSDB |
| SQL state value returned by LindormTSDB |
| Error message returned by LindormTSDB |
For a full list of error codes and messages, see Common error codes.
Example
The following example shows how to catch both exception types and extract diagnostic information:
try {
// Perform a LindormTSDB operation, such as a query.
lindormTSDBClient.query(....);
} catch (LindormTSDBException e) {
System.out.println("Caught an LindormTSDBException, which means your request made it to Lindorm TSDB, "
+ "but was rejected with an error response for some reason.");
System.out.println("Error Code: " + e.getCode());
System.out.println("SQL State: " + e.getSqlstate());
System.out.println("Error Message: " + e.getMessage());
} catch (ClientException ce) {
System.out.println("Caught an ClientException, which means the client encountered "
+ "a serious internal problem while trying to communicate with Lindorm TSDB, "
+ "such as not being able to access the network.");
System.out.println("Error Message: " + ce.getMessage());
}For a full list of error codes and messages, see Common error codes.