2121
2222/**
2323 * <p>
24- * 表示尝试访问阿里云服务时遇到的异常。
24+ * This exception is the one thrown by the client side when accessing OSS.
2525 * </p>
2626 *
2727 * <p>
28- * {@link ClientException}表示的则是在向阿里云服务发送请求时出现的错误,以及客户端无法处理返回结果。
29- * 例如,在发送请求时网络连接不可用,则会抛出{@link ClientException}的异常。
28+ * {@link ClientException} is the class to represent any exception in OSS client side. Generally
29+ * ClientException occurs either before sending the request or after receving the response from OSS server side.
30+ * For example, if the network is broken when it tries to send a request, then the SDK will throw a {@link ClientException}
31+ * instance.
3032 * </p>
3133 *
3234 * <p>
33- * {@link ServiceException}用于处理阿里云服务返回的错误消息。比如,用于身份验证的Access ID不存在,
34- * 则会抛出{@link ServiceException}(严格上讲,会是该类的一个继承类。比如,OSSClient会抛出OSSException)。
35- * 异常中包含了错误代码,用于让调用者进行特定的处理。
36- * </p>
37- *
38- * <p>
39- * 通常来讲,调用者只需要处理{@link ServiceException}。因为该异常表明请求被服务处理,但处理的结果表明
40- * 存在错误。异常中包含了细节的信息,特别是错误代码,可以帮助调用者进行处理。
35+ * {@link ServiceException} is converted from error code from OSS response. For example, when OSS tries to authenticate
36+ * a request, if Access ID does not exist, the SDK will throw a {@link ServiceException} or its subclass instance
37+ * with the specific error code, which the caller could handle that with specific logic.
4138 * </p>
4239 *
4340 */
@@ -50,32 +47,32 @@ public class ClientException extends RuntimeException {
5047 private String errorCode ;
5148
5249 /**
53- * 构造新实例。
50+ * Creates a default instance.
5451 */
5552 public ClientException () {
5653 super ();
5754 }
5855
5956 /**
60- * 用给定的异常信息构造新实例。
61- * @param errorMessage 异常信息。
57+ * Creates an instance with error message.
58+ * @param errorMessage Error message.
6259 */
6360 public ClientException (String errorMessage ) {
6461 this (errorMessage , null );
6562 }
6663
6764 /**
68- * 用表示异常原因的对象构造新实例。
69- * @param cause 异常原因。
65+ * Creates an instance with an exception
66+ * @param cause An exception.
7067 */
7168 public ClientException (Throwable cause ) {
7269 this (null , cause );
7370 }
7471
7572 /**
76- * 用异常消息和表示异常原因的对象构造新实例。
77- * @param errorMessage 异常信息。
78- * @param cause 异常原因。
73+ * Creates an instance with error message and an exception.
74+ * @param errorMessage Error message.
75+ * @param cause An exception.
7976 */
8077 public ClientException (String errorMessage , Throwable cause ) {
8178 super (null , cause );
@@ -85,21 +82,22 @@ public ClientException(String errorMessage, Throwable cause) {
8582 }
8683
8784 /**
88- * 用异常消息构造新实例。
89- * @param errorMessage 异常信息。
90- * @param errorCode 错误码。
91- * @param requestId 请求编号。
85+ * Creates an instance with error message, error code, request Id
86+ * @param errorMessage Error message.
87+ * @param errorCode Error code, which typically is from a set of predefined errors. The handler code could do action
88+ * based on this.
89+ * @param requestId Request Id.
9290 */
9391 public ClientException (String errorMessage , String errorCode , String requestId ) {
9492 this (errorMessage , errorCode , requestId , null );
9593 }
9694
9795 /**
98- * 用异常消息和表示异常原因的对象构造新实例。
99- * @param errorMessage 异常信息。
100- * @param errorCode 错误码。
101- * @param requestId 请求编号。
102- * @param cause 异常原因。
96+ * Creates an instance with error message, error code, request Id and an exception.
97+ * @param errorMessage Error message.
98+ * @param errorCode Error code.
99+ * @param requestId Request Id.
100+ * @param cause An exception.
103101 */
104102 public ClientException (String errorMessage , String errorCode , String requestId , Throwable cause ) {
105103 this (errorMessage , cause );
@@ -108,24 +106,24 @@ public ClientException(String errorMessage, String errorCode, String requestId,
108106 }
109107
110108 /**
111- * 获取异常信息。
112- * @return 异常信息。
109+ * Get error message.
110+ * @return Error message in string.
113111 */
114112 public String getErrorMessage () {
115113 return errorMessage ;
116114 }
117115
118116 /**
119- * 获取异常的错误码
120- * @return 异常错误码
117+ * Get error code.
118+ * @return Error code.
121119 */
122120 public String getErrorCode () {
123121 return errorCode ;
124122 }
125123
126124 /**
127- * 获取本次异常的 RequestId
128- * @return 本次异常的 RequestId
125+ * Gets request id.
126+ * @return The request Id.
129127 */
130128 public String getRequestId () {
131129 return requestId ;
0 commit comments