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