Example usage for com.amazonaws AmazonServiceException getRawResponseContent

List of usage examples for com.amazonaws AmazonServiceException getRawResponseContent

Introduction

In this page you can find the example usage for com.amazonaws AmazonServiceException getRawResponseContent.

Prototype

public String getRawResponseContent() 

Source Link

Document

Typically only useful for debugging purpose if for some reason the SDK cannot parse the HTTP response from a service

Usage

From source file:org.apache.hadoop.fs.s3a.S3AUtils.java

License:Apache License

/**
 * Get low level details of an amazon exception for logging; multi-line.
 * @param e exception/* w w w .j  a  va2s .c  om*/
 * @return string details
 */
public static String stringify(AmazonServiceException e) {
    StringBuilder builder = new StringBuilder(String.format("%s: %s error %d: %s; %s%s%n", e.getErrorType(),
            e.getServiceName(), e.getStatusCode(), e.getErrorCode(), e.getErrorMessage(),
            (e.isRetryable() ? " (retryable)" : "")));
    String rawResponseContent = e.getRawResponseContent();
    if (rawResponseContent != null) {
        builder.append(rawResponseContent);
    }
    return builder.toString();
}