Tablestore SDK for .NET handles errors as exceptions. This topic describes the error handling methods, exceptions, and retry policies of Tablestore SDK for .NET.
Methods
Tablestore SDK for .NET handles errors as exceptions. If no exceptions are returned, the operation is successful. If an exception is returned, the operation fails.
Batch operations such as BatchGetRow and BatchWriteRow are successful only if the system verifies that no exception is returned and the status of each row is successful.
Exceptions
OTSClientException and OTSServerException are common exceptions you may encounter when you use Tablestore SDK for .NET. The two exceptions are inherited from Exception.
OTSClientException: an internal SDK exception such as an invalid parameter value or parsing failure of query results.
OTSServerException: a server error parsed from a server error message. OTSServerException provides the following information:
HttpStatusCode: an HTTP status code such as 200 or 404.
ErrorCode: an error type string returned by Tablestore.
ErrorMessage: an error message string returned by Tablestore.
RequestId: the UUID that identifies the request. If the issue persists, record the value of the RequestId parameter and submit a ticket.
Retries
Tablestore SDK for .NET automatically retries operations when an error occurs. In the default retry policy, the maximum number of retry attempts is 3, and the maximum retry interval is 2,000 milliseconds. For more information, see Retry.
You can also specify a custom retry policy by configuring RetryPolicy in OTSClientConfig.