Baidu AI Cloud
中国站

百度智能云

Elastic IP

Exception Handling

EIP exception is prompted in the following 4 ways:

Exception method Description
BceBaseException Anthology of exceptions
BceClientException Client exception
BceServerException Server exception
InvalidArgumentException System built-in exception, parameter error

You can use try to get exceptions generated by an event:

try {
    $client->resizeEip($eip, $bandwidthInMbps);
} catch (\BaiduBce\Exception\BceBaseException $e) {
    print $e->getMessage();
    if (strcmp(get_class($e), "BaiduBce\Exception\BceClientException") == 0) {
        print "Catch a client exception";
    }
    if (strcmp(get_class($e), "BaiduBce\Exception\BceServiceException") == 0) {
        print "Catch a server exception";
    }
    if (strcmp(get_class($e), "BaiduBce\Exception\BceBaseException") == 0) {
        print "Catch a base exception";
    }
    if (strcmp(get_class($e), "BaiduBce\Exception\InvalidArgumentException") == 0) {
        print "Catch a invalid argument exception";
    }
}

Client Exception

Client exception represents the exception encountered when the client attempts to send a request to EIP and during data transmission. For example, when the network connection is unavailable at the time of sending request, ClientException is returned; and in case of IO exception during file upload, ClientException is also thrown.

Server Exception

In case of exception of EIP service end, EIP service end returns corresponding error information to users to locate the problem. For the common service end exceptions, please see EIP Error Code.

Previous
EipBP Instance
Next
Version Description