private void handleTaskError(@NotNull Task<?, ?> task, @NotNull Throwable throwable, int attempt) {
    if (throwable instanceof ProcessCanceledException || throwable == AsyncPromise.CANCELED || throwable instanceof IndexNotReadyException) {
      offerRestart(task, attempt);
      return;
    }
    try {
      LOG.error(throwable);
    }
    finally {
      task.promise.setError(throwable);
    }
  }
private void handleTaskError(@NotNull Task<?, ?> task, @NotNull Throwable throwable, int attempt)