private String abbreviateErrorMessage(String errorMessage, int maxLength) {
    if (errorMessage.length() < maxLength) {
      return errorMessage;
    }
    String[] parts = errorMessage.split("\n", 2);
    return StringUtils.abbreviate(parts[0], maxLength);
  }
Abbreviates the error message to the given size.

There might be error messages which may also contain a stack trace.
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/ObjectStore.java