code: public static Optional<Throwable> findThrowable(Throwable throwable, Predicate<Throwable> predicate) {
  		if (throwable == null || predicate == null) {
  			return Optional.empty();
  		}
  
  		Throwable t = throwable;
  		while (t != null) {
  			if (predicate.test(t)) {
  				return Optional.of(t);
  			} else {
  				t = t.getCause();
  			}
  		}
  
  		return Optional.empty();
  	}
docs: Checks whether a throwable chain contains an exception matching a predicate and returns it.
  
  @param throwable the throwable chain to check.
  @param predicate the predicate of the exception to search for in the chain.
  @return Optional throwable of the requested type if available, otherwise empty