class ThrowableUtils {

  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;
  }

}