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.
Constructor and Description |
---|
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
|
Modifier and Type | Method and Description |
---|---|
String |
getErrorCode()
Get error code.
|
String |
getErrorMessage()
Get error message.
|
String |
getMessage() |
String |
getRequestId()
Gets request id.
|
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
public ClientException()
public ClientException(String errorMessage)
errorMessage
- Error message.public ClientException(Throwable cause)
cause
- An exception.public ClientException(String errorMessage, Throwable cause)
errorMessage
- Error message.cause
- An exception.public ClientException(String errorMessage, String errorCode, String requestId)
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.public ClientException(String errorMessage, String errorCode, String requestId, Throwable cause)
errorMessage
- Error message.errorCode
- Error code.requestId
- Request Id.cause
- An exception.public String getErrorMessage()
public String getErrorCode()
public String getRequestId()
public String getMessage()
getMessage
in class Throwable
Copyright © 2024. All Rights Reserved.