LegacyErrorUnmarshaller.java 文件源码

java
阅读 19 收藏 0 点赞 0 评论 0

项目:aws-sdk-java-v2 作者:
@Override
public SdkServiceException unmarshall(Node in) throws Exception {
    XPath xpath = XpathUtils.xpath();
    String errorCode = parseErrorCode(in, xpath);
    String message = XpathUtils.asString("Response/Errors/Error/Message", in, xpath);
    String requestId = XpathUtils.asString("Response/RequestID", in, xpath);
    String errorType = XpathUtils.asString("Response/Errors/Error/Type", in, xpath);

    SdkServiceException exception = newException(message);
    exception.errorCode(errorCode);
    exception.requestId(requestId);

    if ("Client".equalsIgnoreCase(errorType)) {
        exception.errorType(ErrorType.CLIENT);
    } else if ("Server".equalsIgnoreCase(errorType)) {
        exception.errorType(ErrorType.SERVICE);
    } else {
        exception.errorType(ErrorType.fromValue(errorType));
    }

    return exception;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号