for (ApiError apiError : result.getPartialFailureErrors()) {
Matcher matcher = operationIndexPattern.matcher(apiError.getFieldPath());
if (matcher.matches()) {
int operationIndex = Integer.parseInt(matcher.group(1));
AdGroupCriterion adGroupCriterion = operations.get(operationIndex).getOperand();
System.out.printf("Ad group criterion with ad group id '%d' and placement '%s' "
+ "triggered a failure for the following reason: '%s'.\n",
adGroupCriterion.getAdGroupId(),
((Placement) adGroupCriterion.getCriterion()).getUrl(), apiError.getErrorString());
} else {
System.out.printf("A failure for the following reason: '%s' has occurred.\n",
apiError.getErrorString());
}
}