public static <T> CompletableFuture<T> exceptionallyCompose(
      final CompletableFuture<T> future,
      final Function<Throwable, CompletionStage<T>> errorHandler) {
    final CompletableFuture<T> result = new CompletableFuture<>();
    future.whenComplete(
        (value, error) -> {
          try {
            final CompletionStage<T> nextStep =
                error != null ? errorHandler.apply(error) : completedFuture(value);
            propagateResult(nextStep, result);
          } catch (final Throwable t) {
            result.completeExceptionally(t);
          }
        });
    return result;
  }
Returns a new CompletionStage that, when the provided stage completes exceptionally, is
executed with the provided stage's exception as the argument to the supplied function.
Otherwise the returned stage completes successfully with the same value as the provided stage.

<p>This is the exceptional equivalent to {@link CompletionStage#thenCompose(Function)}

@param <T> the type of the CompletionStage's result
@param future the future to handle results or exceptions from
@param errorHandler the function returning a new CompletionStage
@return the CompletionStage
util/src/main/java/org/hyperledger/besu/util/FutureUtils.java