code: public static <T> CompletableFuture<T> wrap(Supplier<T> supplier) {
      try {
        return CompletableFuture.completedFuture(supplier.get());
      } catch (Throwable t) {
        return failedFuture(t);
      }
    }
docs: Executes a function on the calling thread and returns result in a {@link CompletableFuture}.
  
  <p>Similar to {@link CompletableFuture#completedFuture} except takes a {@link Supplier} and if
  the supplier throws an unchecked exception, the returning future fails with that exception.
  
  @param supplier Function to execute
  @param <T> Type of result
  @return result of function wrapped in future