public class AmazonServiceException extends SdkClientException
AmazonServiceException 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.
Modifier and Type | Class and Description |
---|---|
static class |
AmazonServiceException.ErrorType
Indicates who is responsible (if known) for a failed request.
|
Constructor and Description |
---|
AmazonServiceException(String errorMessage)
Constructs a new AmazonServiceException with the specified message.
|
AmazonServiceException(String errorMessage,
Exception cause)
Constructs a new AmazonServiceException with the specified message and
exception indicating the root cause.
|
Modifier and Type | Method and Description |
---|---|
String |
getErrorCode()
Returns the AWS error code represented by this exception.
|
String |
getErrorMessage() |
AmazonServiceException.ErrorType |
getErrorType()
Indicates who is responsible for this exception (caller, service,
or unknown).
|
Map<String,String> |
getHttpHeaders() |
String |
getMessage() |
String |
getProxyHost()
Returns proxy host if configured.
|
byte[] |
getRawResponse()
Returns the response payload as bytes.
|
String |
getRawResponseContent()
Typically only useful for debugging purpose if for some reason the SDK cannot parse the HTTP
response from a service
|
String |
getRequestId()
Returns the AWS request ID that uniquely identifies the service request
the caller made.
|
String |
getServiceName()
Returns the name of the service that sent this error response.
|
int |
getStatusCode()
Returns the HTTP status code that was returned with this service
exception.
|
void |
setErrorCode(String errorCode)
Sets the AWS error code represented by this exception.
|
void |
setErrorMessage(String value)
Sets the human-readable error message provided by the service.
|
void |
setErrorType(AmazonServiceException.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 |
setHttpHeaders(Map<String,String> httpHeaders)
Sets the headers present in the error response.
|
void |
setProxyHost(String proxyHost)
Sets proxy host.
|
void |
setRawResponse(byte[] rawResponse)
Sets the raw response content.
|
void |
setRawResponseContent(String rawResponseContent)
Sets the raw response content.
|
void |
setRequestId(String requestId)
Sets the AWS requestId for this exception.
|
void |
setServiceName(String serviceName)
Sets the name of the service that sent this error response.
|
void |
setStatusCode(int statusCode)
Sets the HTTP status code that was returned with this service exception.
|
isRetryable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
public AmazonServiceException(String errorMessage)
errorMessage
- An error message describing what went wrong.public AmazonServiceException(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 setServiceName(String serviceName)
serviceName
- The name of the service that sent this error response.public String getServiceName()
public void setErrorCode(String errorCode)
errorCode
- The AWS error code represented by this exception.public String getErrorCode()
public void setErrorType(AmazonServiceException.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 AmazonServiceException.ErrorType getErrorType()
public String getErrorMessage()
public void setErrorMessage(String value)
AmazonServiceException(String)
,
AmazonServiceException#AmazonServiceException(String, Exception))
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
public String getRawResponseContent()
public void setRawResponseContent(String rawResponseContent)
public byte[] getRawResponse()
public void setRawResponse(byte[] rawResponse)
public Map<String,String> getHttpHeaders()
public void setHttpHeaders(Map<String,String> httpHeaders)
public String getProxyHost()
null
public void setProxyHost(String proxyHost)
proxyHost
- the proxy host to setCopyright © 2020. All rights reserved.