in aws-networkfirewall-rulegroup/src/main/java/software/amazon/networkfirewall/rulegroup/ExceptionTranslator.java [24:50]
public static RuntimeException translateToCfnException(final AwsServiceException e) {
RuntimeException toReturn = null;
if (e instanceof InvalidRequestException) {
if (e.getMessage() != null && e.getMessage().contains("A resource with the specified name already exists")) {
toReturn = new CfnAlreadyExistsException(e);
} else {
toReturn = new CfnInvalidRequestException(e);
}
} else if (e instanceof ThrottlingException) {
toReturn = new CfnThrottlingException(e);
} else if (e instanceof InternalServerErrorException) {
toReturn = new CfnServiceInternalErrorException(e);
} else if (e instanceof ResourceNotFoundException) {
toReturn = new CfnNotFoundException(e);
} else if (e instanceof InvalidTokenException) {
toReturn = new CfnInvalidRequestException(e);
} else if (e instanceof LimitExceededException) {
toReturn = new CfnServiceLimitExceededException(e);
} else if (e instanceof InsufficientCapacityException) {
toReturn = new CfnServiceInternalErrorException(e);
} else if (e instanceof InvalidOperationException) {
toReturn = new CfnInvalidRequestException(e);
} else {
toReturn = new CfnGeneralServiceException(e.getMessage(), e);
}
return toReturn;
}