private static Tuple2<Boolean, Integer> chooseStatusFromError(ErrorMessage error) {

        Tuple2<Boolean, Integer> webServiceStatus = chooseWebServiceStatus(error);
        if (webServiceStatus.first) {
            return webServiceStatus;
        }
        if (error.getCode() == NO_BACKENDS_IN_SERVICE.code)
            return new Tuple2<>(true, Response.Status.SERVICE_UNAVAILABLE);
        if (error.getCode() == TIMEOUT.code)
            return new Tuple2<>(true, Response.Status.GATEWAY_TIMEOUT);
        if (error.getCode() == BACKEND_COMMUNICATION_ERROR.code)
            return new Tuple2<>(true, Response.Status.SERVICE_UNAVAILABLE);
        if (error.getCode() == ILLEGAL_QUERY.code)
            return new Tuple2<>(true, Response.Status.BAD_REQUEST);
        if (error.getCode() == INVALID_QUERY_PARAMETER.code)
            return new Tuple2<>(true, Response.Status.BAD_REQUEST);
        return NO_MATCH;
    }
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