Error handling

Last Updated: Sep 14, 2017

Method

Currently, the Table Store Python SDK adopts the Exception method to handle errors. Operation is successful if the called interface does not throw an exception. If an exception is thrown, operation fails.

Note: Batch operation interfaces such as batch_get_row and batch_write_row are successfully called only when the system checks that the status of each row is successful.

Exception

The Table Store python SDK has two types of exceptions: OTSClientError and OTSServiceError inherited from Exception.

  • OTSClientError: Indicates an internal SDK exception, for example, incorrect parameter values or failure to return parsed results.

  • OTSServiceError: Indicates a server error generated by parsing a server error message. OTSServiceError has the following components:

    • get_http_status: Returned HTTP code, for example, 200 or 404.

    • get_error_code: Error type string returned by Table Store.

    • get_error_message: Error message string returned by Table Store.

    • get_request_id: UUID that uniquely identifies a request. Send the RequestId to Table Store engineers for help when the problem persists.

Retry

  • The system retries the operation when an error occurs in the SDK. By default, the operation is retried 20 times at a maximum interval of three seconds. For details about how the system retries the operation on throttling errors and read-related internal server errors, see tablestore/lib/retry.js.

  • You can inherit RetryPolicy to customize a retry policy, and pass it in as a parameter when constructing OTSClient object.

  • SDK has the following retry policies:

    • DefaultRetryPolicy: The default retry policy. Only the read operation is retried 20 times at a maximum interval of three seconds.
    • NoRetryPolicy: No retry.
    • NoDelayRetryPolicy: A retry policy without any delays. This policy should be used with caution.
    • WriteRetryPolicy: The write operation is retried based on the default retry policy.
Thank you! We've received your feedback.