public class ClientException
extends java.lang.RuntimeException
表示尝试访问阿里云服务时遇到的异常。
ClientException
表示的则是在向阿里云服务发送请求时出现的错误,以及客户端无法处理返回结果。
例如,在发送请求时网络连接不可用,则会抛出ClientException
的异常。
ServiceException
用于处理阿里云服务返回的错误消息。比如,用于身份验证的Access ID不存在,
则会抛出ServiceException
(严格上讲,会是该类的一个继承类。比如,OTSClient会抛出OTSException)。
异常中包含了错误代码,用于让调用者进行特定的处理。
通常来讲,调用者只需要处理ServiceException
。因为该异常表明请求被服务处理,但处理的结果表明
存在错误。异常中包含了细节的信息,特别是错误代码,可以帮助调用者进行处理。
构造器和说明 |
---|
ClientException()
构造新实例。
|
ClientException(java.lang.String message)
用给定的异常信息构造新实例。
|
ClientException(java.lang.String errorCode,
java.lang.String message,
java.lang.Throwable cause)
用异常消息和表示异常原因的对象构造新实例。
|
ClientException(java.lang.String message,
java.lang.Throwable cause)
用异常消息和表示异常原因的对象构造新实例。
|
ClientException(java.lang.Throwable cause)
用表示异常原因的对象构造新实例。
|
限定符和类型 | 方法和说明 |
---|---|
java.lang.String |
getErrorCode()
获取异常的错误码
|
public ClientException()
public ClientException(java.lang.String message)
message
- 异常信息。public ClientException(java.lang.Throwable cause)
cause
- 异常原因。public ClientException(java.lang.String message, java.lang.Throwable cause)
message
- 异常信息。cause
- 异常原因。public ClientException(java.lang.String errorCode, java.lang.String message, java.lang.Throwable cause)
errorCode
- 错误码message
- 异常信息。cause
- 异常原因。