All Products
Search
Document Center

Object Storage Service:Exception handling (Android SDK)

Last Updated:Nov 29, 2025

OSS SDK for Android has two types of exceptions: ClientException and ServiceException.

ClientException

A ClientException indicates an exception that occurs when a client sends a request or transmit data to OSS. For example, a ClientException is returned when a request is sent under poor network conditions. A ClientException is also returned when an I/O exception occurs during object upload.

ServiceException

A ServiceException indicates a server error that is resolved from a server error message. A ServiceException includes the error code and message returned by OSS so that you can identify and resolve the error.

The following table describes the information included in a ServiceException.

Parameter

Description

Code

The error code returned by OSS.

Message

The detailed error message returned by OSS.

RequestId

The universally unique identifier (UUID) for the request. If you need help, provide this RequestId to troubleshoot the problem.

HostId

The ID of the host in the accessed OSS cluster. This ID is the same as the host specified in the request.

rawMessage

The raw text of the body in the HTTP response.

Common OSS error codes

For more information about the common error codes of OSS, see Error responses.