code: public static void validateTrackingRefUpdates(String errorPrefix, Collection<TrackingRefUpdate> refUpdates) {
                  for (TrackingRefUpdate refUpdate : refUpdates) {
                          RefUpdate.Result result = refUpdate.getResult();
  
                          if (result == RefUpdate.Result.IO_FAILURE ||
                              result == RefUpdate.Result.LOCK_FAILURE ||
                              result == RefUpdate.Result.REJECTED ||
                              result == RefUpdate.Result.REJECTED_CURRENT_BRANCH ) {
                                  throw new BuildException(String.format("%s - Status '%s'", errorPrefix, result.name()));
                          }
                  }
          }
docs: Check references updates for any errors
  
  @param errorPrefix The error prefix for any error message
  @param refUpdates A collection of tracking references updates