@SafeVarargs
  @ApiStatus.Internal
  public static <E extends Exception>
  void runAllAndRethrowAllExceptions(@NotNull Function<List<? extends Throwable>, E> exceptionsCombiner,
                                     ThrowableRunnable<? extends Exception> @NotNull ... potentiallyFailingTasks) throws E {
    List<Throwable> exceptions = null;
    for (ThrowableRunnable<? extends Exception> potentiallyFailingTask : potentiallyFailingTasks) {
      try {
        potentiallyFailingTask.run();
      }
      catch (Throwable e) {
        if (exceptions == null) {
          exceptions = new ArrayList<>();
        }
        exceptions.add(e);
      }
    }

    if (exceptions != null) {
      throw exceptionsCombiner.apply(exceptions);
    }
  }
@SafeVarargs
  @ApiStatus.Internal
  public static <E extends Exception>
  void runAllAndRethrowAllExceptions(@NotNull Function<List<? extends Throwable>, E> exceptionsCombiner,
                                     ThrowableRunnable<? extends Exception> @NotNull ... potentiallyFailingTasks)