static Throwable unwrapThrowable()

in src/main/java/com/spotify/futures/CompletableToListenableFutureWrapper.java [65:75]


  static Throwable unwrapThrowable(Throwable throwable) {
    // Don't go too deep in case there is recursive exceptions
    for (int i = 0; i < 100; i++) {
      if (throwable instanceof CompletionException) {
        throwable = throwable.getCause();
      } else {
        break;
      }
    }
    return throwable;
  }