All Products
Search
Document Center

Object Storage Service:Handle exceptions

Last Updated:Sep 11, 2023

If a request error occurs when you use Object Storage Service (OSS) SDK for Ruby, an exception is thrown. In this case, a log file records the detailed information about the exception. By default, the detailed information is recorded in the oss_sdk.log file. The following types of exceptions exist in OSS SDK for Ruby: ClientError and ServerError. Both types of exceptions are subclasses of the RuntimeError exception.

ClientError

ClientError exceptions are caused by errors inside the SDK. For example, a ClientError exception is thrown when the setting of a parameter is invalid or when objects are modified during resumable upload or download.

ServerError

ServerError exceptions are caused by errors on the server and are the parsing results of the error messages on the server. ServerError exceptions include the following parameters:

  • http_code: the HTTP status code.

  • error_code: the error code that is returned by OSS.

  • message: the OSS error message.

  • request_id: the UUID that uniquely identifies the request. If you cannot handle the exception, you can provide OSS technical support with the request ID to seek help.

For more information, see Overview.