@Override
  public ScheduledQuery getScheduledQuery(ScheduledQueryKey key) throws NoSuchObjectException {
    Optional<MScheduledQuery> mScheduledQuery = getMScheduledQuery(key);
    if (!mScheduledQuery.isPresent()) {
      throw new NoSuchObjectException(
          "There is no scheduled query for: " + scheduledQueryKeyRef(key));
    }
    return mScheduledQuery.get().toThrift();

  }
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