- Documentation
Torch Object Storage
SDK Reference
PHP
Exception Handling
Exception Handling (PHP SDK)
Exception Handling
Exception Handling (PHP SDK)
Exception Handling (PHP SDK)
This article introduces exception handling when using the TOS SDK.
Exception Description
Exceptions are categorized as client-side exceptions and server-side exceptions, corresponding to TosClientError and TosServerError, respectively. A server-side exception must include the HTTP status code and response headers returned by the server. The struct definition for exceptions is as follows:
The TOS server complies with HTTP standards and defines detailed HTTP status codes and business error codes for scenarios involving request failures. For details on error codes, please refer to TOS Server-Side Status and Error Code Definitions. SDK Custom Exceptions
The TOS PHP SDK encapsulates two types of custom exceptions based on TOS server-side errors: Tos\Exception\TosClientException and Tos\Exception\TosServerException. The former typically indicates a request parameter error, in which case the request is not sent to the server. The latter represents errors returned by the server after a request has been sent; this exception provides access to detailed error information returned from the server.
Last updated: 2025.09.23 14:41:21