com.amazonaws.AmazonServiceException.getErrorCode()方法的使用及代码示例

x33g5p2x  于2022-01-15 转载在 其他  
字(7.4k)|赞(0)|评价(0)|浏览(108)

本文整理了Java中com.amazonaws.AmazonServiceException.getErrorCode()方法的一些代码示例,展示了AmazonServiceException.getErrorCode()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AmazonServiceException.getErrorCode()方法的具体详情如下:
包路径:com.amazonaws.AmazonServiceException
类名称:AmazonServiceException
方法名:getErrorCode

AmazonServiceException.getErrorCode介绍

[英]Returns the AWS error code represented by this exception.
[中]返回此异常表示的AWS错误代码。

代码示例

代码示例来源:origin: aws/aws-sdk-java

/**
 * Takes the response exception and determines whether this exception matches the expected exception, by
 * comparing the respective error codes.
 * 
 * @param e
 *        Response Exception
 * @return True if it matches, False otherwise
 */
@Override
public boolean matches(AmazonServiceException e) {
  return "InvalidTarget".equals(e.getErrorCode());
}

代码示例来源:origin: aws/aws-sdk-java

/**
 * Takes the response exception and determines whether this exception matches the expected exception, by
 * comparing the respective error codes.
 * 
 * @param e
 *        Response Exception
 * @return True if it matches, False otherwise
 */
@Override
public boolean matches(AmazonServiceException e) {
  return "InvalidVpcPeeringConnectionID.NotFound".equals(e.getErrorCode());
}

代码示例来源:origin: aws/aws-sdk-java

/**
 * Takes the response exception and determines whether this exception matches the expected exception, by
 * comparing the respective error codes.
 * 
 * @param e
 *        Response Exception
 * @return True if it matches, False otherwise
 */
@Override
public boolean matches(AmazonServiceException e) {
  return "ResourceNotFoundException".equals(e.getErrorCode());
}

代码示例来源:origin: aws/aws-sdk-java

/**
 * Takes the response exception and determines whether this exception matches the expected exception, by
 * comparing the respective error codes.
 * 
 * @param e
 *        Response Exception
 * @return True if it matches, False otherwise
 */
@Override
public boolean matches(AmazonServiceException e) {
  return "ResourceNotFoundException".equals(e.getErrorCode());
}

代码示例来源:origin: aws/aws-sdk-java

/**
 * Takes the response exception and determines whether this exception matches the expected exception, by
 * comparing the respective error codes.
 * 
 * @param e
 *        Response Exception
 * @return True if it matches, False otherwise
 */
@Override
public boolean matches(AmazonServiceException e) {
  return "NatGatewayNotFound".equals(e.getErrorCode());
}

代码示例来源:origin: aws/aws-sdk-java

/**
 * Takes the response exception and determines whether this exception matches the expected exception, by
 * comparing the respective error codes.
 * 
 * @param e
 *        Response Exception
 * @return True if it matches, False otherwise
 */
@Override
public boolean matches(AmazonServiceException e) {
  return "ResourceNotFoundFault".equals(e.getErrorCode());
}

代码示例来源:origin: aws/aws-sdk-java

/**
 * Takes the response exception and determines whether this exception matches the expected exception, by
 * comparing the respective error codes.
 * 
 * @param e
 *        Response Exception
 * @return True if it matches, False otherwise
 */
@Override
public boolean matches(AmazonServiceException e) {
  return "ResourceNotFoundException".equals(e.getErrorCode());
}

代码示例来源:origin: aws/aws-sdk-java

/**
 * Takes the response exception and determines whether this exception matches the expected exception, by
 * comparing the respective error codes.
 * 
 * @param e
 *        Response Exception
 * @return True if it matches, False otherwise
 */
@Override
public boolean matches(AmazonServiceException e) {
  return "InvalidInstanceID.NotFound".equals(e.getErrorCode());
}

代码示例来源:origin: aws/aws-sdk-java

/**
 * Takes the response exception and determines whether this exception matches the expected exception, by
 * comparing the respective error codes.
 * 
 * @param e
 *        Response Exception
 * @return True if it matches, False otherwise
 */
@Override
public boolean matches(AmazonServiceException e) {
  return "ClusterNotFound".equals(e.getErrorCode());
}

代码示例来源:origin: aws/aws-sdk-java

/**
 * Takes the response exception and determines whether this exception matches the expected exception, by
 * comparing the respective error codes.
 * 
 * @param e
 *        Response Exception
 * @return True if it matches, False otherwise
 */
@Override
public boolean matches(AmazonServiceException e) {
  return "DBInstanceNotFound".equals(e.getErrorCode());
}

代码示例来源:origin: aws/aws-sdk-java

/**
 * Takes the response exception and determines whether this exception matches the expected exception, by
 * comparing the respective error codes.
 * 
 * @param e
 *        Response Exception
 * @return True if it matches, False otherwise
 */
@Override
public boolean matches(AmazonServiceException e) {
  return "ResourceNotFoundException".equals(e.getErrorCode());
}

代码示例来源:origin: aws/aws-sdk-java

/**
 * Takes the response exception and determines whether this exception matches the expected exception, by
 * comparing the respective error codes.
 * 
 * @param e
 *        Response Exception
 * @return True if it matches, False otherwise
 */
@Override
public boolean matches(AmazonServiceException e) {
  return "ValidationException".equals(e.getErrorCode());
}

代码示例来源:origin: aws/aws-sdk-java

/**
 * Takes the response exception and determines whether this exception matches the expected exception, by
 * comparing the respective error codes.
 * 
 * @param e
 *        Response Exception
 * @return True if it matches, False otherwise
 */
@Override
public boolean matches(AmazonServiceException e) {
  return "ResourceNotFoundException".equals(e.getErrorCode());
}

代码示例来源:origin: aws/aws-sdk-java

/**
 * Takes the response exception and determines whether this exception matches the expected exception, by
 * comparing the respective error codes.
 * 
 * @param e
 *        Response Exception
 * @return True if it matches, False otherwise
 */
@Override
public boolean matches(AmazonServiceException e) {
  return "InvalidInstance".equals(e.getErrorCode());
}

代码示例来源:origin: aws/aws-sdk-java

/**
 * Takes the response exception and determines whether this exception matches the expected exception, by
 * comparing the respective error codes.
 * 
 * @param e
 *        Response Exception
 * @return True if it matches, False otherwise
 */
@Override
public boolean matches(AmazonServiceException e) {
  return "LoadBalancerNotFound".equals(e.getErrorCode());
}

代码示例来源:origin: aws/aws-sdk-java

/**
 * Takes the response exception and determines whether this exception matches the expected exception, by
 * comparing the respective error codes.
 * 
 * @param e
 *        Response Exception
 * @return True if it matches, False otherwise
 */
@Override
public boolean matches(AmazonServiceException e) {
  return "LoadBalancerNotFound".equals(e.getErrorCode());
}

代码示例来源:origin: apache/incubator-druid

static boolean isServiceExceptionRecoverable(AmazonServiceException ex)
{
 final boolean isIOException = ex.getCause() instanceof IOException;
 final boolean isTimeout = "RequestTimeout".equals(ex.getErrorCode());
 return isIOException || isTimeout;
}

代码示例来源:origin: apache/incubator-druid

private static boolean isServiceExceptionRecoverable(AmazonServiceException ex)
{
 final boolean isIOException = ex.getCause() instanceof IOException;
 final boolean isTimeout = "RequestTimeout".equals(ex.getErrorCode());
 return isIOException || isTimeout;
}

代码示例来源:origin: aws/aws-sdk-java

@Then("^I expect the response error code to be \"(.+?)\"$")
public void then_I_expect_response_error_code(String expected) {
  assertNotNull(exception);
  assertTrue(exception instanceof AmazonServiceException);
  String actual = exception.getErrorCode();
  assertEquals("Error code doesn't match. Expected : " + expected + ". Actual :" + actual, expected, actual);
}

代码示例来源:origin: aws/aws-sdk-java

@Override
public AmazonServiceException handle(HttpResponse errorResponse) throws Exception {
  AmazonServiceException ase = createAse(errorResponse);
  if (ase == null) {
    throw new SdkClientException("Unable to unmarshall error response from service");
  }
  ase.setHttpHeaders(errorResponse.getHeaders());
  if (StringUtils.isNullOrEmpty(ase.getErrorCode())) {
    ase.setErrorCode(errorResponse.getStatusCode() + " " + errorResponse.getStatusText());
  }
  return ase;
}

相关文章