public static <T> List<T> findCauseAndSuppressed(@NotNull Throwable error, @NotNull Class<T> klass) {
    Collection<Throwable> allThrowables = new LinkedHashSet<>();
    Deque<Throwable> deque = new ArrayDeque<>();
    deque.add(error);
    while (!deque.isEmpty()) {
      Throwable t = deque.removeFirst();
      if (allThrowables.add(t)) {
        for (Throwable cause = t.getCause(); cause != null; cause = cause.getCause()) {
          deque.addLast(cause);
        }
        for (Throwable s : t.getSuppressed()) {
          deque.addLast(s);
        }
      }
    }
    return ContainerUtil.filterIsInstance(allThrowables, klass);
  }
public static <T> List<T> findCauseAndSuppressed(@NotNull Throwable error, @NotNull Class<T> klass)