class ListOffsetRequest extends AbstractRequest {

    @Override
    public AbstractResponse getErrorResponse(int throttleTimeMs, Throwable e) {
        short versionId = version();
        short errorCode = Errors.forException(e).code();

        List<ListOffsetTopicResponse> responses = new ArrayList<>();
        for (ListOffsetTopic topic : data.topics()) {
            ListOffsetTopicResponse topicResponse = new ListOffsetTopicResponse().setName(topic.name());
            List<ListOffsetPartitionResponse> partitions = new ArrayList<>();
            for (ListOffsetPartition partition : topic.partitions()) {
                ListOffsetPartitionResponse partitionResponse = new ListOffsetPartitionResponse()
                        .setErrorCode(errorCode)
                        .setPartitionIndex(partition.partitionIndex());
                if (versionId == 0) {
                    partitionResponse.setOldStyleOffsets(Collections.emptyList());
                } else {
                    partitionResponse.setOffset(ListOffsetResponse.UNKNOWN_OFFSET)
                                     .setTimestamp(ListOffsetResponse.UNKNOWN_TIMESTAMP);
                }
                partitions.add(partitionResponse);
            }
            topicResponse.setPartitions(partitions);
            responses.add(topicResponse);
        }
        ListOffsetResponseData responseData = new ListOffsetResponseData()
                .setThrottleTimeMs(throttleTimeMs)
                .setTopics(responses);
        return new ListOffsetResponse(responseData);
    }

    private  ListOffsetRequest(short version, ListOffsetRequestData data);
    public  ListOffsetRequest(Struct struct, short version);

}