Exception handling
Updated at:2025-10-16
EIP exception prompts are available in the following four ways:
| Exception type | Description |
|---|---|
| BceBaseException | Collection of exceptions |
| BceClientException | Client exception |
| BceServerException | Server exception |
| InvalidArgumentException | System-built-in exceptions, parameter errors |
Users can use try to obtain the exception generated by a certain event:
PHP
1try {
2 $client->resizeEip($eip, $bandwidthInMbps);
3} catch (\BaiduBce\Exception\BceBaseException $e) {
4 print $e->getMessage();
5 if (strcmp(get_class($e), "BaiduBce\Exception\BceClientException") == 0) {
6 print "Catch a client exception";
7 }
8 if (strcmp(get_class($e), "BaiduBce\Exception\BceServiceException") == 0) {
9 print "Catch a server exception";
10 }
11 if (strcmp(get_class($e), "BaiduBce\Exception\BceBaseException") == 0) {
12 print "Catch a base exception";
13 }
14 if (strcmp(get_class($e), "BaiduBce\Exception\InvalidArgumentException") == 0) {
15 print "Catch a invalid argument exception";
16 }
17};
Client exception
A client exception occurs when the client faces issues during request transmission or file uploads to EIP. For example, a ClientException is thrown in cases of network failures or I/O errors.
Server exception
A server exception is generated when EIP server-side errors occur. The service returns detailed error messages to assist troubleshooting. For common server exceptions, refer to EIP Error Code.
