public static Throwable causeByType(Throwable parent, Class<? extends Throwable> causeType,
      boolean isSubtypeOk) {
    Throwable cause = null;
    int foundAtIndex = indexOfCause(parent, causeType, isSubtypeOk);
    if (foundAtIndex != -1) {
      cause = causeAt(parent, foundAtIndex);
    }
    return cause;
  }
Returns the first occurrence of nested cause of <code>parent</code> which matches the specified
<code>causeType</code> or its sub-type depending on <code>isSubtypeOk</code> value.

@param parent Throwable to use to find the cause of given type
@param causeType type of the nested Throwable cause
@param isSubtypeOk whether any matching sub-type is required or exact match is required
@return the first occurrence of nested cause which matches the specified <code>causeType</code>
        or its sub-type. <code>null</code> if it can't find it.
geode-gfsh/src/main/java/org/apache/geode/management/internal/cli/util/CauseFinder.java