This topic describes the error handling methods in Tablestore SDK for .NET.

Methods

Tablestore SDK for Java handles errors as exceptions. The operation is successful if no exceptions are returned for the called operation. If an exception is returned, the operation fails.

Note Batch API operations such as BatchGetRow and BatchWriteRow are called only when the status check of each row is successful.

Exceptions

Tablestore SDK for .NET has two types of exceptions: OTSClientException and OTSServerException. Both are inherited from Exception.

  • OTSClientException: an internal SDK exception such as an incorrect parameter value or a failure to parse the results returned by the server.
  • OTSServerException: a server error. When a server error occurs, the server parses and returns the error message to the client. OTSServerException has the following components:
    • 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 uniquely identifies a request. If a problem persists, submit the request ID to Tablestore technical support personnel to seek help.

Retry

  • Tablestore SDK for .NET automatically retries an operation when an error occurs. In the default retry policy, the maximum retry attempts is 3, and the maximum retry interval is 2s.
  • You can modify RetryPolicy in OTSClientConfig to customize a retry policy.