當前位置: 首頁>>代碼示例>>Java>>正文


Java AmazonServiceException.getErrorMessage方法代碼示例

本文整理匯總了Java中com.amazonaws.AmazonServiceException.getErrorMessage方法的典型用法代碼示例。如果您正苦於以下問題:Java AmazonServiceException.getErrorMessage方法的具體用法?Java AmazonServiceException.getErrorMessage怎麽用?Java AmazonServiceException.getErrorMessage使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.amazonaws.AmazonServiceException的用法示例。


在下文中一共展示了AmazonServiceException.getErrorMessage方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: populateAndEndSubsegment

import com.amazonaws.AmazonServiceException; //導入方法依賴的package包/類
private void populateAndEndSubsegment(Subsegment currentSubsegment, Request<?> request, Response<?> response, AmazonServiceException ase) {
    if (null != response) {
        populateAndEndSubsegment(currentSubsegment, request, response);
        return;
    } else if (null != ase) {
        if (null != ase.getRequestId()) {
            currentSubsegment.putAws(REQUEST_ID_SUBSEGMENT_KEY, ase.getRequestId());
        }
        if (null != ase.getHttpHeaders() && null != ase.getHttpHeaders().get(S3_EXTENDED_REQUEST_ID_HEADER_KEY)) {
            currentSubsegment.putAws(EXTENDED_REQUEST_ID_SUBSEGMENT_KEY, ase.getHttpHeaders().get(S3_EXTENDED_REQUEST_ID_HEADER_KEY));
        }
        if (null != ase.getErrorMessage()) {
            currentSubsegment.getCause().setMessage(ase.getErrorMessage());
        }
        currentSubsegment.putAllHttp(extractHttpResponseInformation(ase));
    }

    finalizeSubsegment(request);
}
 
開發者ID:aws,項目名稱:aws-xray-sdk-java,代碼行數:20,代碼來源:TracingHandler.java

示例2: handle

import com.amazonaws.AmazonServiceException; //導入方法依賴的package包/類
@Override
public AmazonServiceException handle(HttpResponse response) throws Exception {
    JsonContent jsonContent = JsonContent.createJsonContent(response, jsonFactory);
    String errorCode = errorCodeParser.parseErrorCode(response, jsonContent);
    AmazonServiceException ase = createException(errorCode, jsonContent);

    // Jackson has special-casing for 'message' values when deserializing
    // Throwables, but sometimes the service passes the error message in
    // other JSON fields - handle it here.
    if (ase.getErrorMessage() == null) {
        ase.setErrorMessage(errorMessageParser.parseErrorMessage(response, jsonContent.getJsonNode()));
    }

    ase.setErrorCode(errorCode);
    ase.setServiceName(response.getRequest().getServiceName());
    ase.setStatusCode(response.getStatusCode());
    ase.setErrorType(getErrorTypeFromStatusCode(response.getStatusCode()));
    ase.setRawResponse(jsonContent.getRawContent());
    String requestId = getRequestIdFromHeaders(response.getHeaders());
    if (requestId != null) {
        ase.setRequestId(requestId);
    }
    ase.setHttpHeaders(response.getHeaders());
    return ase;
}
 
開發者ID:IBM,項目名稱:ibm-cos-sdk-java,代碼行數:26,代碼來源:JsonErrorResponseHandler.java

示例3: test

import com.amazonaws.AmazonServiceException; //導入方法依賴的package包/類
/**
 * @return True to retry with SigV4, false to not retry
 */
@Override
public boolean test(AmazonServiceException ase) {
    if (ase == null || ase.getErrorMessage() == null) {
        return false;
    }
    if (AUTH_ERROR_CODES.contains(ase.getErrorCode())) {
        for (String possibleErrorMessage : AUTH_ERROR_MESSAGES) {
            if (ase.getErrorMessage().contains(possibleErrorMessage)) {
                return true;
            }
        }
    }
    return false;
}
 
開發者ID:IBM,項目名稱:ibm-cos-sdk-java,代碼行數:18,代碼來源:IsSigV4RetryablePredicate.java


注:本文中的com.amazonaws.AmazonServiceException.getErrorMessage方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。