code: public static <T extends Throwable> Optional<T> findThrowable(Throwable throwable, Class<T> searchType) {
  		if (throwable == null || searchType == null) {
  			return Optional.empty();
  		}
  
  		Throwable t = throwable;
  		while (t != null) {
  			if (searchType.isAssignableFrom(t.getClass())) {
  				return Optional.of(searchType.cast(t));
  			} else {
  				t = t.getCause();
  			}
  		}
  
  		return Optional.empty();
  	}
docs: Checks whether a throwable chain contains a specific type of exception and returns it.
  
  @param throwable the throwable chain to check.
  @param searchType the type of exception to search for in the chain.
  @return Optional throwable of the requested type if available, otherwise empty