private void logMessageAndThrow(String operationName, int attempts, int maxRetries, Exception e) throws Exception {
    logger.warn("{} failed with an exception. re-attempt {}/{}", operationName, attempts - 1, maxRetries, e);
    if (attempts - 1 >= maxRetries) {
      logger.error("{} failed due to an exception after {} re-attempts", operationName, attempts - 1, e);
      throw e;
    }
  }
Log the message and throw the exception
@param operationName the name of the operation
@param attempts the number of attempts
@param maxRetries the maximum number of retries
@param e the exception to throw
ambry-file-transfer/src/main/java/com/github/ambry/filetransfer/utils/OperationRetryHandler.java