private boolean validateStateChange(QueryState from, QueryState to) {
    switch (from) {
    case INITED:
      return to != QueryState.INITED;
    case EXECUTING:
      return to == QueryState.FINISHED
          || to == QueryState.EXECUTING
          || to == QueryState.FAILED
          || to == QueryState.TIMED_OUT;
    default:
      return false;
    }
  }
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