Browse Source

add error codes 45-60

Robin 8 years ago
parent
commit
d2ef45883e
1 changed files with 94 additions and 46 deletions
  1. 94 46
      errors.go

+ 94 - 46
errors.go

@@ -71,52 +71,68 @@ type KError int16
 
 // Numeric error codes returned by the Kafka server.
 const (
-	ErrNoError                         KError = 0
-	ErrUnknown                         KError = -1
-	ErrOffsetOutOfRange                KError = 1
-	ErrInvalidMessage                  KError = 2
-	ErrUnknownTopicOrPartition         KError = 3
-	ErrInvalidMessageSize              KError = 4
-	ErrLeaderNotAvailable              KError = 5
-	ErrNotLeaderForPartition           KError = 6
-	ErrRequestTimedOut                 KError = 7
-	ErrBrokerNotAvailable              KError = 8
-	ErrReplicaNotAvailable             KError = 9
-	ErrMessageSizeTooLarge             KError = 10
-	ErrStaleControllerEpochCode        KError = 11
-	ErrOffsetMetadataTooLarge          KError = 12
-	ErrNetworkException                KError = 13
-	ErrOffsetsLoadInProgress           KError = 14
-	ErrConsumerCoordinatorNotAvailable KError = 15
-	ErrNotCoordinatorForConsumer       KError = 16
-	ErrInvalidTopic                    KError = 17
-	ErrMessageSetSizeTooLarge          KError = 18
-	ErrNotEnoughReplicas               KError = 19
-	ErrNotEnoughReplicasAfterAppend    KError = 20
-	ErrInvalidRequiredAcks             KError = 21
-	ErrIllegalGeneration               KError = 22
-	ErrInconsistentGroupProtocol       KError = 23
-	ErrInvalidGroupId                  KError = 24
-	ErrUnknownMemberId                 KError = 25
-	ErrInvalidSessionTimeout           KError = 26
-	ErrRebalanceInProgress             KError = 27
-	ErrInvalidCommitOffsetSize         KError = 28
-	ErrTopicAuthorizationFailed        KError = 29
-	ErrGroupAuthorizationFailed        KError = 30
-	ErrClusterAuthorizationFailed      KError = 31
-	ErrInvalidTimestamp                KError = 32
-	ErrUnsupportedSASLMechanism        KError = 33
-	ErrIllegalSASLState                KError = 34
-	ErrUnsupportedVersion              KError = 35
-	ErrTopicAlreadyExists              KError = 36
-	ErrInvalidPartitions               KError = 37
-	ErrInvalidReplicationFactor        KError = 38
-	ErrInvalidReplicaAssignment        KError = 39
-	ErrInvalidConfig                   KError = 40
-	ErrNotController                   KError = 41
-	ErrInvalidRequest                  KError = 42
-	ErrUnsupportedForMessageFormat     KError = 43
-	ErrPolicyViolation                 KError = 44
+	ErrNoError                            KError = 0
+	ErrUnknown                            KError = -1
+	ErrOffsetOutOfRange                   KError = 1
+	ErrInvalidMessage                     KError = 2
+	ErrUnknownTopicOrPartition            KError = 3
+	ErrInvalidMessageSize                 KError = 4
+	ErrLeaderNotAvailable                 KError = 5
+	ErrNotLeaderForPartition              KError = 6
+	ErrRequestTimedOut                    KError = 7
+	ErrBrokerNotAvailable                 KError = 8
+	ErrReplicaNotAvailable                KError = 9
+	ErrMessageSizeTooLarge                KError = 10
+	ErrStaleControllerEpochCode           KError = 11
+	ErrOffsetMetadataTooLarge             KError = 12
+	ErrNetworkException                   KError = 13
+	ErrOffsetsLoadInProgress              KError = 14
+	ErrConsumerCoordinatorNotAvailable    KError = 15
+	ErrNotCoordinatorForConsumer          KError = 16
+	ErrInvalidTopic                       KError = 17
+	ErrMessageSetSizeTooLarge             KError = 18
+	ErrNotEnoughReplicas                  KError = 19
+	ErrNotEnoughReplicasAfterAppend       KError = 20
+	ErrInvalidRequiredAcks                KError = 21
+	ErrIllegalGeneration                  KError = 22
+	ErrInconsistentGroupProtocol          KError = 23
+	ErrInvalidGroupId                     KError = 24
+	ErrUnknownMemberId                    KError = 25
+	ErrInvalidSessionTimeout              KError = 26
+	ErrRebalanceInProgress                KError = 27
+	ErrInvalidCommitOffsetSize            KError = 28
+	ErrTopicAuthorizationFailed           KError = 29
+	ErrGroupAuthorizationFailed           KError = 30
+	ErrClusterAuthorizationFailed         KError = 31
+	ErrInvalidTimestamp                   KError = 32
+	ErrUnsupportedSASLMechanism           KError = 33
+	ErrIllegalSASLState                   KError = 34
+	ErrUnsupportedVersion                 KError = 35
+	ErrTopicAlreadyExists                 KError = 36
+	ErrInvalidPartitions                  KError = 37
+	ErrInvalidReplicationFactor           KError = 38
+	ErrInvalidReplicaAssignment           KError = 39
+	ErrInvalidConfig                      KError = 40
+	ErrNotController                      KError = 41
+	ErrInvalidRequest                     KError = 42
+	ErrUnsupportedForMessageFormat        KError = 43
+	ErrPolicyViolation                    KError = 44
+	ErrOutOfOrderSequenceNumber           KError = 45
+	ErrDuplicateSequenceNumber            KError = 46
+	ErrInvalidProducerEpoch               KError = 47
+	ErrInvalidTxnState                    KError = 48
+	ErrInvalidProducerIDMapping           KError = 49
+	ErrInvalidTransactionTimeout          KError = 50
+	ErrConcurrentTransactions             KError = 51
+	ErrTransactionCoordinatorFenced       KError = 52
+	ErrTransactionalIDAuthorizationFailed KError = 53
+	ErrSecurityDisabled                   KError = 54
+	ErrOperationNotAttempted              KError = 55
+	ErrKafkaStorageError                  KError = 56
+	ErrLogDirNotFound                     KError = 57
+	ErrSASLAuthenticationFailed           KError = 58
+	ErrUnknownProducerID                  KError = 59
+	ErrReassignmentInProgress             KError = 60
 )
 
 func (err KError) Error() string {
@@ -215,6 +231,38 @@ func (err KError) Error() string {
 		return "kafka server: The requested operation is not supported by the message format version."
 	case ErrPolicyViolation:
 		return "kafka server: Request parameters do not satisfy the configured policy."
+	case ErrOutOfOrderSequenceNumber:
+		return "kafka server: The broker received an out of order sequence number."
+	case ErrDuplicateSequenceNumber:
+		return "kafka server: The broker received a duplicate sequence number."
+	case ErrInvalidProducerEpoch:
+		return "kafka server: Producer attempted an operation with an old epoch."
+	case ErrInvalidTxnState:
+		return "kafka server: The producer attempted a transactional operation in an invalid state."
+	case ErrInvalidProducerIDMapping:
+		return "kafka server: The producer attempted to use a producer id which is not currently assigned to its transactional id."
+	case ErrInvalidTransactionTimeout:
+		return "kafka server: The transaction timeout is larger than the maximum value allowed by the broker (as configured by max.transaction.timeout.ms)."
+	case ErrConcurrentTransactions:
+		return "kafka server: The producer attempted to update a transaction while another concurrent operation on the same transaction was ongoing."
+	case ErrTransactionCoordinatorFenced:
+		return "kafka server: The transaction coordinator sending a WriteTxnMarker is no longer the current coordinator for a given producer."
+	case ErrTransactionalIDAuthorizationFailed:
+		return "kafka server: Transactional ID authorization failed."
+	case ErrSecurityDisabled:
+		return "kafka server: Security features are disabled."
+	case ErrOperationNotAttempted:
+		return "kafka server: The broker did not attempt to execute this operation."
+	case ErrKafkaStorageError:
+		return "kafka server: Disk error when trying to access log file on the disk."
+	case ErrLogDirNotFound:
+		return "kafka server: The specified log directory is not found in the broker config."
+	case ErrSASLAuthenticationFailed:
+		return "kafka server: SASL Authentication failed."
+	case ErrUnknownProducerID:
+		return "kafka server: The broker could not locate the producer metadata associated with the Producer ID."
+	case ErrReassignmentInProgress:
+		return "kafka server: A partition reassignment is in progress."
 	}
 
 	return fmt.Sprintf("Unknown error, how did this happen? Error code = %d", err)