public class AmazonServiceException extends AmazonClientException
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(java.lang.String errorMessage)
Constructs a new AmazonServiceException with the specified message.
|
AmazonServiceException(java.lang.String errorMessage,
java.lang.Exception cause)
Constructs a new AmazonServiceException with the specified message and
exception indicating the root cause.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getErrorCode()
Returns the AWS error code represented by this exception.
|
java.lang.String |
getErrorMessage() |
AmazonServiceException.ErrorType |
getErrorType()
Indicates who is responsible for this exception (caller, service, or
unknown).
|
java.lang.String |
getMessage() |
java.lang.String |
getRequestId()
Returns the AWS request ID that uniquely identifies the service request
the caller made.
|
java.lang.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(java.lang.String errorCode)
Sets the AWS error code represented by this exception.
|
void |
setErrorMessage(java.lang.String errorMessage) |
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 |
setRequestId(java.lang.String requestId)
Sets the AWS requestId for this exception.
|
void |
setServiceName(java.lang.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
public AmazonServiceException(java.lang.String errorMessage)
errorMessage
- An error message describing what went wrong.public AmazonServiceException(java.lang.String errorMessage, java.lang.Exception cause)
errorMessage
- An error message describing what went wrong.cause
- The root exception that caused this exception to be thrown.public void setRequestId(java.lang.String requestId)
requestId
- The unique identifier for the service request the caller
made.public java.lang.String getRequestId()
public void setServiceName(java.lang.String serviceName)
serviceName
- The name of the service that sent this error response.public java.lang.String getServiceName()
public void setErrorCode(java.lang.String errorCode)
errorCode
- The AWS error code represented by this exception.public java.lang.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 java.lang.String getErrorMessage()
public void setStatusCode(int statusCode)
statusCode
- The HTTP status code that was returned with this
service exception.public int getStatusCode()
public java.lang.String getMessage()
getMessage
in class java.lang.Throwable
public void setErrorMessage(java.lang.String errorMessage)
errorMessage
- sets the error message.Copyright © 2018 Amazon Web Services, Inc. All Rights Reserved.