public boolean hasOnlyErrorCode(int code) {
        for (ErrorMessage error : errors) {
            if (error.getCode() != code)
                return false;
        }
        return true;
    }
Returns true if all errors in this have the given code
container-search/src/main/java/com/yahoo/search/result/DefaultErrorHit.java