|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
com.baidubce.BceClientException
com.baidubce.BceServiceException
public class BceServiceException
Extension of BceClientException that represents an error response returned by a BCE service. Receiving an exception of this type indicates that the caller's request was correctly transmitted to the service, but for some reason, the service was not able to process it, and returned an error response instead.
BceServiceException 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.
Nested Class Summary | |
---|---|
static class |
BceServiceException.ErrorType
Indicates who is responsible (if known) for a failed request. |
Constructor Summary | |
---|---|
BceServiceException(String errorMessage)
Constructs a new BceServiceException with the specified message. |
|
BceServiceException(String errorMessage,
Exception cause)
Constructs a new BceServiceException with the specified message and exception indicating the root cause. |
Method Summary | |
---|---|
String |
getErrorCode()
Returns the BCE error code represented by this exception. |
String |
getErrorMessage()
Returns the human-readable error message provided by the service. |
BceServiceException.ErrorType |
getErrorType()
Indicates who is responsible for this exception (caller, service, or unknown). |
String |
getMessage()
|
String |
getRequestId()
Returns the BCE 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. |
void |
setErrorCode(String errorCode)
Sets the BCE error code represented by this exception. |
void |
setErrorMessage(String errorMessage)
Sets the human-readable error message provided by the service. |
void |
setErrorType(BceServiceException.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 BCE requestId for this exception. |
void |
setStatusCode(int statusCode)
Sets the HTTP status code that was returned with this service exception. |
Methods inherited from class java.lang.Throwable |
---|
fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public BceServiceException(String errorMessage)
errorMessage
- An error message describing what went wrong.public BceServiceException(String errorMessage, Exception cause)
errorMessage
- An error message describing what went wrong.cause
- The root exception that caused this exception to be thrown.Method Detail |
---|
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 BCE error code represented by this exception.public String getErrorCode()
public void setErrorType(BceServiceException.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 BceServiceException.ErrorType getErrorType()
public void setErrorMessage(String errorMessage)
errorMessage
- the human-readable error message provided by the service.public String getErrorMessage()
public void setStatusCode(int statusCode)
statusCode
- The HTTP status code that was returned with this service exception.public int getStatusCode()
public String getMessage()
getMessage
in class Throwable
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |