Skip to content

Instantly share code, notes, and snippets.

@reecefenwick
Created April 21, 2016 03:17
Show Gist options
  • Save reecefenwick/19565dd70cbc199525315a7dc63f7f28 to your computer and use it in GitHub Desktop.
Save reecefenwick/19565dd70cbc199525315a7dc63f7f28 to your computer and use it in GitHub Desktop.
public class AmazonServiceException extends AmazonClientException {
private static final long serialVersionUID = 1L;
private String requestId;
private String errorCode;
private AmazonServiceException.ErrorType errorType;
private String errorMessage;
private int statusCode;
private String serviceName;
private String rawResponseContent;
public AmazonServiceException(String errorMessage) {
super((String)null);
this.errorType = AmazonServiceException.ErrorType.Unknown;
this.errorMessage = errorMessage;
}
public AmazonServiceException(String errorMessage, Exception cause) {
super((String)null, cause);
this.errorType = AmazonServiceException.ErrorType.Unknown;
this.errorMessage = errorMessage;
}
public void setRequestId(String requestId) {
this.requestId = requestId;
}
public String getRequestId() {
return this.requestId;
}
public void setServiceName(String serviceName) {
this.serviceName = serviceName;
}
public String getServiceName() {
return this.serviceName;
}
public void setErrorCode(String errorCode) {
this.errorCode = errorCode;
}
public String getErrorCode() {
return this.errorCode;
}
public void setErrorType(AmazonServiceException.ErrorType errorType) {
this.errorType = errorType;
}
public AmazonServiceException.ErrorType getErrorType() {
return this.errorType;
}
public String getErrorMessage() {
return this.errorMessage;
}
public void setErrorMessage(String value) {
this.errorMessage = value;
}
public void setStatusCode(int statusCode) {
this.statusCode = statusCode;
}
public int getStatusCode() {
return this.statusCode;
}
public String getMessage() {
return this.getErrorMessage() + " (Service: " + this.getServiceName() + "; Status Code: " + this.getStatusCode() + "; Error Code: " + this.getErrorCode() + "; Request ID: " + this.getRequestId() + ")";
}
public String getRawResponseContent() {
return this.rawResponseContent;
}
public void setRawResponseContent(String rawResponseContent) {
this.rawResponseContent = rawResponseContent;
}
public static enum ErrorType {
Client,
Service,
Unknown;
private ErrorType() {
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment