public class YopServiceException extends YopClientException
YopServiceException provides callers several pieces of information that can be used to obtain more information about the error and why it occurred. In particular, the errorType field can be used to determine if the caller's request was invalid, or the service encountered an error on the server side while processing it.
| 限定符和类型 | 类和说明 |
|---|---|
static class |
YopServiceException.ErrorType
Indicates who is responsible (if known) for a failed request.
|
| 构造器和说明 |
|---|
YopServiceException(String errorMessage)
Constructs a new YopServiceException with the specified message.
|
YopServiceException(String errorMessage,
Exception cause)
Constructs a new YopServiceException with the specified message and exception indicating the root cause.
|
| 限定符和类型 | 方法和说明 |
|---|---|
String |
getDocUrl() |
String |
getErrorCode()
Returns the YOP error code represented by this exception.
|
String |
getErrorMessage()
Returns the human-readable error message provided by the service.
|
YopServiceException.ErrorType |
getErrorType()
Indicates who is responsible for this exception (caller, service, or unknown).
|
String |
getMessage() |
String |
getRequestId()
Returns the YOP request ID that uniquely identifies the service request the caller made.
|
int |
getStatusCode()
Returns the HTTP status code that was returned with this service exception.
|
String |
getSubErrorCode() |
String |
getSubMessage() |
void |
setDocUrl(String docUrl) |
void |
setErrorCode(String errorCode)
Sets the YOP error code represented by this exception.
|
void |
setErrorMessage(String errorMessage)
Sets the human-readable error message provided by the service.
|
void |
setErrorType(YopServiceException.ErrorType errorType)
Sets the type of error represented by this exception (sender, receiver, or unknown),
indicating if this exception was the caller's fault, or the service's fault.
|
void |
setRequestId(String requestId)
Sets the YOP requestId for this exception.
|
void |
setStatusCode(int statusCode)
Sets the HTTP status code that was returned with this service exception.
|
void |
setSubErrorCode(String subErrorCode) |
void |
setSubMessage(String subMessage) |
public YopServiceException(String errorMessage)
errorMessage - An error message describing what went wrong.public YopServiceException(String errorMessage, Exception cause)
errorMessage - An error message describing what went wrong.cause - The root exception that caused this exception to be thrown.public void setRequestId(String requestId)
requestId - The unique identifier for the service request the caller made.public String getRequestId()
public void setErrorCode(String errorCode)
errorCode - The YOP error code represented by this exception.public String getErrorCode()
public String getSubErrorCode()
public void setSubErrorCode(String subErrorCode)
public void setErrorType(YopServiceException.ErrorType errorType)
errorType - The type of error represented by this exception (sender or receiver),
indicating if this exception was the caller's fault or the service's fault.public YopServiceException.ErrorType getErrorType()
public void setErrorMessage(String errorMessage)
errorMessage - the human-readable error message provided by the service.public String getErrorMessage()
public String getSubMessage()
public void setSubMessage(String subMessage)
public void setStatusCode(int statusCode)
statusCode - The HTTP status code that was returned with this service exception.public String getDocUrl()
public void setDocUrl(String docUrl)
public int getStatusCode()
public String getMessage()
getMessage 在类中 ThrowableCopyright © 2024. All rights reserved.