code: private RetriesExhaustedWithDetailsException getExceptions()
        throws RetriesExhaustedWithDetailsException {
      if (!hasExceptions.get()) {
        return null;
      }
  
      ArrayList<MutationException> mutationExceptions = null;
      synchronized (globalExceptions) {
        hasExceptions.set(false);
        if (globalExceptions.isEmpty()) {
          return null;
        }
  
        mutationExceptions = new ArrayList<>(globalExceptions);
        globalExceptions.clear();
      }
  
      List<Throwable> problems = new ArrayList<>(mutationExceptions.size());
      ArrayList<String> hostnames = new ArrayList<>(mutationExceptions.size());
      List<Row> failedMutations = new ArrayList<>(mutationExceptions.size());
  
      if (!mutationExceptions.isEmpty()) {
        LOG.warn("Exception occurred in BufferedMutator", mutationExceptions.get(0).throwable);
      }
      for (MutationException mutationException : mutationExceptions) {
        problems.add(mutationException.throwable);
        failedMutations.add(mutationException.mutation);
        hostnames.add(host);
        LOG.debug("Exception occurred in BufferedMutator", mutationException.throwable);
      }
  
      return new RetriesExhaustedWithDetailsException(problems, failedMutations, hostnames);
    }
docs: Create a {@link RetriesExhaustedWithDetailsException} if there were any async exceptions and
  send it to the {@link org.apache.hadoop.hbase.client.BufferedMutator.ExceptionListener}.