private DefaultErrorHit consumeAnyQueryErrors() {
        if (errorHit != null) return null;
        if (getQuery() == null) return null;
        if (getQuery().errors().isEmpty()) return null;

        // Move errors from the query into this
        List<ErrorMessage> queryErrors = getQuery().errors().stream().map(this::toSearchError).toList();
        getQuery().errors().clear(); // TODO: Remove this line (not promised, can be done at any time)
        return new DefaultErrorHit(getSource(), queryErrors);
    }
Consumes errors from the query and returns them in a new error hit

@return the error hit containing all query errors, or null if no query errors should be consumed
container-search/src/main/java/com/yahoo/search/result/HitGroup.java