程序包 com.baidubce
类 BceServiceException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- java.lang.RuntimeException
-
- com.baidubce.BceClientException
-
- com.baidubce.BceServiceException
-
- 所有已实现的接口:
Serializable
public class BceServiceException extends BceClientException
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.
- 另请参阅:
- 序列化表格
-
-
嵌套类概要
嵌套类 修饰符和类型 类 说明 static classBceServiceException.ErrorTypeIndicates who is responsible (if known) for a failed request.
-
构造器概要
构造器 构造器 说明 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.
-
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 StringgetErrorCode()Returns the BCE error code represented by this exception.StringgetErrorMessage()Returns the human-readable error message provided by the service.BceServiceException.ErrorTypegetErrorType()Indicates who is responsible for this exception (caller, service, or unknown).StringgetMessage()StringgetRequestId()Returns the BCE request ID that uniquely identifies the service request the caller made.intgetStatusCode()Returns the HTTP status code that was returned with this service exception.voidsetErrorCode(String errorCode)Sets the BCE error code represented by this exception.voidsetErrorMessage(String errorMessage)Sets the human-readable error message provided by the service.voidsetErrorType(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.voidsetRequestId(String requestId)Sets the BCE requestId for this exception.voidsetStatusCode(int statusCode)Sets the HTTP status code that was returned with this service exception.
-
-
-
构造器详细资料
-
BceServiceException
public BceServiceException(String errorMessage)
Constructs a new BceServiceException with the specified message.- 参数:
errorMessage- An error message describing what went wrong.
-
BceServiceException
public BceServiceException(String errorMessage, Exception cause)
Constructs a new BceServiceException with the specified message and exception indicating the root cause.- 参数:
errorMessage- An error message describing what went wrong.cause- The root exception that caused this exception to be thrown.
-
-
方法详细资料
-
setRequestId
public void setRequestId(String requestId)
Sets the BCE requestId for this exception.- 参数:
requestId- The unique identifier for the service request the caller made.
-
getRequestId
public String getRequestId()
Returns the BCE request ID that uniquely identifies the service request the caller made.- 返回:
- The BCE request ID that uniquely identifies the service request the caller made.
-
setErrorCode
public void setErrorCode(String errorCode)
Sets the BCE error code represented by this exception.- 参数:
errorCode- The BCE error code represented by this exception.
-
getErrorCode
public String getErrorCode()
Returns the BCE error code represented by this exception.- 返回:
- The BCE error code represented by this exception.
-
setErrorType
public 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.- 参数:
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.
-
getErrorType
public BceServiceException.ErrorType getErrorType()
Indicates who is responsible for this exception (caller, service, or unknown).- 返回:
- A value indicating who is responsible for this exception (caller, service, or unknown).
-
setErrorMessage
public void setErrorMessage(String errorMessage)
Sets the human-readable error message provided by the service.- 参数:
errorMessage- the human-readable error message provided by the service.
-
getErrorMessage
public String getErrorMessage()
Returns the human-readable error message provided by the service.- 返回:
- the human-readable error message provided by the service.
-
setStatusCode
public void setStatusCode(int statusCode)
Sets the HTTP status code that was returned with this service exception.- 参数:
statusCode- The HTTP status code that was returned with this service exception.
-
getStatusCode
public int getStatusCode()
Returns the HTTP status code that was returned with this service exception.- 返回:
- The HTTP status code that was returned with this service exception.
-
getMessage
public String getMessage()
- 覆盖:
getMessage在类中Throwable
-
-