code: public static <T> @NonNull CompletableFuture<T> immediateFailedFuture(final @NonNull Throwable ex) {
      final CompletableFuture<T> future = new CompletableFuture<>();
      future.completeExceptionally(ex);
      return future;
    }
docs: Returns a completable future that is exceptionally completed with the provided exception.
  
  @param ex the throwable
  @param <T> the type
  @return an exceptionally completed completable future