code: public static <R> R join(CompletionStage<R> stage) {
        try {
           return CompletableFutures.await(stage.toCompletableFuture());
        } catch (ExecutionException e) {
           throw new CompletionException(e.getCause());
        } catch (InterruptedException e) {
           throw new CompletionException(e);
        }
     }
docs: Returns the result value when complete, or throws an (unchecked) exception if completed exceptionally.
  To better conform with the use of common functional forms, if a computation involved in the completion of this
  CompletionStage threw an exception, this method throws an (unchecked) CompletionException with the underlying
  exception as its cause.
  @param stage stage to wait on
  @param <R> the type in the stage
  @return the result value
  @throws CompletionException if this stage completed exceptionally or a completion computation threw an exception