class SafeFuture extends CompletableFuture<T> {

  public static void reportExceptions(final CompletionStage<?> future) {
    future.exceptionally(
        error -> {
          final Thread currentThread = Thread.currentThread();
          currentThread.getUncaughtExceptionHandler().uncaughtException(currentThread, error);
          return null;
        });
  }

}