private ReplicationMetricList getMReplicationMetrics(String policy) {
    ReplicationMetricList ret = new ReplicationMetricList();
    if (StringUtils.isEmpty(policy)) {
      return ret;
    }
    try (QueryWrapper query = new QueryWrapper(pm.newQuery(MReplicationMetrics.class, "policy == policyParam"))) {
      query.declareParameters("java.lang.String policyParam");
      query.setOrdering("scheduledExecutionId descending");
      List<MReplicationMetrics> list = (List<MReplicationMetrics>) query.execute(policy);
      List<ReplicationMetrics> returnList = new ArrayList<>();
      for (MReplicationMetrics mReplicationMetric : list) {
        pm.retrieve(mReplicationMetric);
        returnList.add(MReplicationMetrics.toThrift(mReplicationMetric));
      }
      ret.setReplicationMetricList(returnList);
      return ret;
    }
  }
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