com.aliyun.oss

## 类 ClientException

- java.lang.Object
- - java.lang.Throwable
  - - java.lang.Exception
    - - java.lang.RuntimeException
      - - com.aliyun.oss.ClientException

- 所有已实现的接口:
    Serializable

      public class ClientException
      extends RuntimeException

  This exception is the one thrown by the client side when accessing OSS.

  `ClientException` is the class to represent any exception in OSS client side. Generally ClientException occurs either before sending the request or after receving the response from OSS server side. For example, if the network is broken when it tries to send a request, then the SDK will throw a `ClientException` instance.

  `ServiceException` is converted from error code from OSS response. For example, when OSS tries to authenticate a request, if Access ID does not exist, the SDK will throw a `ServiceException` or its subclass instance with the specific error code, which the caller could handle that with specific logic.

  另请参阅:
    序列化表格

- - ### 构造器概要

    构造器
    构造器和说明
    `ClientException()` Creates a default instance.
    `ClientException(String errorMessage)` Creates an instance with error message.
    `ClientException(String errorMessage, String errorCode, String requestId)` Creates an instance with error message, error code, request Id
    `ClientException(String errorMessage, String errorCode, String requestId, Throwable cause)` Creates an instance with error message, error code, request Id and an exception.
    `ClientException(String errorMessage, Throwable cause)` Creates an instance with error message and an exception.
    `ClientException(Throwable cause)` Creates an instance with an exception

  - ### 方法概要

    方法
    限定符和类型 | 方法和说明
    --- | ---
    `String` | `getErrorCode()` Get error code.
    `String` | `getErrorMessage()` Get error message.
    `String` | `getMessage()`
    `String` | `getRequestId()` Gets request id.

    - ### 从类继承的方法 java.lang.Throwable

      `addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString`

    - ### 从类继承的方法 java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### 构造器详细资料

    - #### ClientException

          public ClientException()

      Creates a default instance.

    - #### ClientException

          public ClientException(String errorMessage)

      Creates an instance with error message.
      参数:
        `errorMessage` - Error message.

    - #### ClientException

          public ClientException(Throwable cause)

      Creates an instance with an exception
      参数:
        `cause` - An exception.

    - #### ClientException

          public ClientException(String errorMessage,
                         Throwable cause)

      Creates an instance with error message and an exception.
      参数:
        `errorMessage` - Error message.
        `cause` - An exception.

    - #### ClientException

          public ClientException(String errorMessage,
                         String errorCode,
                         String requestId)

      Creates an instance with error message, error code, request Id
      参数:
        `errorMessage` - Error message.
        `errorCode` - Error code, which typically is from a set of predefined errors. The handler code could do action based on this.
        `requestId` - Request Id.

    - #### ClientException

          public ClientException(String errorMessage,
                         String errorCode,
                         String requestId,
                         Throwable cause)

      Creates an instance with error message, error code, request Id and an exception.
      参数:
        `errorMessage` - Error message.
        `errorCode` - Error code.
        `requestId` - Request Id.
        `cause` - An exception.

  - ### 方法详细资料

    - #### getErrorMessage

          public String getErrorMessage()

      Get error message.
      返回:
        Error message in string.

    - #### getErrorCode

          public String getErrorCode()

      Get error code.
      返回:
        Error code.

    - #### getRequestId

          public String getRequestId()

      Gets request id.
      返回:
        The request Id.

    - #### getMessage

          public String getMessage()

      覆盖:
        `getMessage` 在类中 `Throwable`

Copyright © 2020. All Rights Reserved.