All Products
Search
Document Center

Object Storage Service:Handle exceptions (Ruby SDK)

Last Updated:Mar 20, 2026

OSS SDK for Ruby throws exceptions when a request fails. Exception details are logged to oss_sdk.log in the program's running directory. The SDK defines two exception types: ClientError and ServerError. Both are subclasses of RuntimeError.

ClientError

ClientError exceptions are caused by errors inside the SDK — for example, an invalid parameter value or an object being modified during resumable upload or download.

ServerError

ServerError exceptions are caused by server-side errors. Each ServerError contains the following fields parsed from the server's error response:

FieldDescription
http_codeHTTP status code
error_codeError code returned by OSS
messageOSS error message
request_idUUID that uniquely identifies the request. Provide this to OSS technical support when seeking help.

What's next