public static boolean hasCauseMessage(Throwable throwable, String message) {
    if (throwable.getMessage().contains(message)) {
      return true;
    }

    Throwable cause;
    while ((cause = throwable.getCause()) != null) {
      throwable = cause;
      if (throwable.getMessage().contains(message)) {
        return true;
      }
    }

    return false;
  }
Returns true if the {@link Throwable} or any of its causes contain the specified
{@code message}.

@param throwable the {@code Throwable} to check the causes of.
@param message the {@code Throwable} message to check for.
@return true if any cause of {@code throwable} contains the specified {@code message}.

@throws NullPointerException if {@code throwable} is null
geode-core/src/main/java/org/apache/geode/internal/lang/ThrowableUtils.java