Exception Handling
Last Updated:2020-07-20
System Exception
EIP system exception is prompted in the following 3 ways.
Exception method | Description |
---|---|
BceHttpClientError | Exception thrown during retry |
last_error | Exception thrown during the final retry |
BceClientError | Exception generated by client |
BceInvalidArgumentError | Exception generated by introduced parameter |
BceServerError | Exception generated by server |
You can use try to get exceptions generated by an event.
from baidubce import exception
from baidubce.services import eip
try:
eip_client.list_eips()
except exception.BceHttpError as e:
print e.message
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 during request sending, BceHttpClientError is thrown; in case of IO exception during file upload, BceClientError is also thrown.
Server Exception
When an exception occurs on the BOS server, the BOS server returns the corresponding error message to the user to locate the problem. For the common service end exceptions, please see EIP Error Code.