private void HandleResponseErrors(Fetch request, FetchResponse response)
{
switch ((ErrorResponseCode)response.Error)
{
case ErrorResponseCode.NoError:
return;
case ErrorResponseCode.OffsetOutOfRange:
throw new OffsetOutOfRangeException("FetchResponse indicated we requested an offset that is out of range. Requested Offset:{0}", request.Offset) { FetchRequest = request };
case ErrorResponseCode.BrokerNotAvailable:
case ErrorResponseCode.ConsumerCoordinatorNotAvailableCode:
case ErrorResponseCode.LeaderNotAvailable:
case ErrorResponseCode.NotLeaderForPartition:
throw new InvalidMetadataException("FetchResponse indicated we may have mismatched metadata. ErrorCode:{0}", response.Error) { ErrorCode = response.Error };
default:
throw new KafkaApplicationException("FetchResponse returned error condition. ErrorCode:{0}", response.Error) { ErrorCode = response.Error };
}
}