public static int getEagerErrorStatus(ErrorMessage mainError, Iterator<? extends ErrorMessage> allErrors) {
        if (mainError == null ) return Response.Status.OK;

        // Iterate over all errors
        if (allErrors != null && allErrors.hasNext()) {
            for (; allErrors.hasNext();) {
                ErrorMessage error = allErrors.next();
                Tuple2<Boolean, Integer> status = chooseStatusFromError(error);
                if (status.first) {
                    return status.second;
                }
            }
        } else {
            Tuple2<Boolean, Integer> status = chooseStatusFromError(mainError);
            if (status.first) {
                return status.second;
            }
        }

        // Default return code for errors
        return Response.Status.INTERNAL_SERVER_ERROR;
    }
Returns 5xx or 4xx if there is any error present in the result, 200 otherwise

@param mainError The main error of the response.
@param allErrors All the errors of the response, if any.
@return The error status code of the given response.
container-core/src/main/java/com/yahoo/container/jdisc/VespaHeaders.java