forked from elodina/siesta
-
Notifications
You must be signed in to change notification settings - Fork 0
/
errors.go
162 lines (121 loc) · 7.04 KB
/
errors.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
/* Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. */
package siesta
import "errors"
// Signals that an end of file or stream has been reached unexpectedly.
var ErrEOF = errors.New("End of file reached")
// Happens when a compressed message is empty.
var ErrNoDataToUncompress = errors.New("No data to uncompress")
// A mapping for Kafka error code 0.
var ErrNoError = errors.New("No error - it worked!")
// A mapping for Kafka error code -1.
var ErrUnknown = errors.New("An unexpected server error")
// A mapping for Kafka error code 1.
var ErrOffsetOutOfRange = errors.New("The requested offset is outside the range of offsets maintained by the server for the given topic/partition.")
// A mapping for Kafka error code 2.
var ErrInvalidMessage = errors.New("Message contents does not match its CRC")
// A mapping for Kafka error code 3.
var ErrUnknownTopicOrPartition = errors.New("This request is for a topic or partition that does not exist on this broker.")
// A mapping for Kafka error code 4.
var ErrInvalidMessageSize = errors.New("The message has a negative size")
// A mapping for Kafka error code 5.
var ErrLeaderNotAvailable = errors.New("In the middle of a leadership election and there is currently no leader for this partition and hence it is unavailable for writes.")
// A mapping for Kafka error code 6.
var ErrNotLeaderForPartition = errors.New("You've just attempted to send messages to a replica that is not the leader for some partition. It indicates that the clients metadata is out of date.")
// A mapping for Kafka error code 7.
var ErrRequestTimedOut = errors.New("Request exceeds the user-specified time limit in the request.")
// A mapping for Kafka error code 8.
var ErrBrokerNotAvailable = errors.New("Broker is likely not alive.")
// A mapping for Kafka error code 9.
var ErrReplicaNotAvailable = errors.New("Replica is expected on a broker, but is not (this can be safely ignored).")
// A mapping for Kafka error code 10.
var ErrMessageSizeTooLarge = errors.New("You've just attempted to produce a message of size larger than broker is allowed to accept.")
// A mapping for Kafka error code 11.
var ErrStaleControllerEpochCode = errors.New("Broker-to-broker communication fault.")
// A mapping for Kafka error code 12.
var ErrOffsetMetadataTooLargeCode = errors.New("You've jsut specified a string larger than configured maximum for offset metadata.")
// A mapping for Kafka error code 14.
var ErrOffsetsLoadInProgressCode = errors.New("Offset loading is in progress. (Usually happens after a leader change for that offsets topic partition).")
// A mapping for Kafka error code 15.
var ErrConsumerCoordinatorNotAvailableCode = errors.New("Offsets topic has not yet been created.")
// A mapping for Kafka error code 16.
var ErrNotCoordinatorForConsumerCode = errors.New("There is no coordinator for this consumer.")
// A mapping for Kafka error code 17
var ErrInvalidTopicCode = errors.New("Attempt to access an invalid topic.")
// A mapping for Kafka error code 18
var ErrRecordListTooLarge = errors.New("Message batch exceeds the maximum configured segment size.")
// A mapping for Kafka error code 19
var ErrNotEnoughReplicas = errors.New("The number of in-sync replicas is lower than the configured minimum.")
// A mapping for Kafka error code 20
var ErrNotEnoughReplicasAfterAppend = errors.New("The message was written to the log, but with fewer in-sync replicas than required.")
// A mapping for Kafka error code 21
var ErrInvalidRequiredAcks = errors.New("The requested requiredAcks is invalid.")
// A mapping for Kafka error code 22
var ErrIllegalGeneration = errors.New("The generation id provided in the request is not the current generation.")
// A mapping for Kafka error code 23
var ErrInconsistentGroupProtocol = errors.New("Provided protocol type or set of protocols is not compatible with the current group.")
// A mapping for Kafka error code 24
var ErrInvalidGroupID = errors.New("The groupId is empty or null.")
// A mapping for Kafka error code 25
var ErrUnknownMemberID = errors.New("The memberId is not in the current generation.")
// A mapping for Kafka error code 26
var ErrInvalidSessionTimeout = errors.New("The requested session timeout is outside of the allowed range on the broker.")
// A mapping for Kafka error code 27
var ErrRebalanceInProgress = errors.New("The coordinator has begun rebalancing the group. This indicates to the client that it should rejoin the group.")
// A mapping for Kafka error code 28
var ErrInvalidCommitOffsetSize = errors.New("Offset commit was rejected because of oversize metadata.")
// A mapping for Kafka error code 29
var ErrTopicAuthorizationFailed = errors.New("The client is not authorized to access the requested topic.")
// A mapping for Kafka error code 30
var ErrGroupAuthorizationFailed = errors.New("The client is not authorized to access a particular groupId.")
// A mapping for Kafka error code 31
var ErrClusterAuthorizationFailed = errors.New("The client is not authorized to use an inter-broker or administrative API.")
// ErrFailedToGetMetadata happens when TopicMetadataResponse does not contain metadata for requested topic.
var ErrFailedToGetMetadata = errors.New("Failed to get topic metadata.")
// ErrFailedToGetLeader happens when TopicMetadataResponse does not contain leader metadata for requested topic and partition.
var ErrFailedToGetLeader = errors.New("Failed to get leader.")
// Mapping between Kafka error codes and actual error messages.
var BrokerErrors = map[int16]error{
-1: ErrUnknown,
0: ErrNoError,
1: ErrOffsetOutOfRange,
2: ErrInvalidMessage,
3: ErrUnknownTopicOrPartition,
4: ErrInvalidMessageSize,
5: ErrLeaderNotAvailable,
6: ErrNotLeaderForPartition,
7: ErrRequestTimedOut,
8: ErrBrokerNotAvailable,
9: ErrReplicaNotAvailable,
10: ErrMessageSizeTooLarge,
11: ErrStaleControllerEpochCode,
12: ErrOffsetMetadataTooLargeCode,
14: ErrOffsetsLoadInProgressCode,
15: ErrConsumerCoordinatorNotAvailableCode,
16: ErrNotCoordinatorForConsumerCode,
17: ErrInvalidTopicCode,
18: ErrRecordListTooLarge,
19: ErrNotEnoughReplicas,
20: ErrNotEnoughReplicasAfterAppend,
21: ErrInvalidRequiredAcks,
22: ErrIllegalGeneration,
23: ErrInconsistentGroupProtocol,
24: ErrInvalidGroupID,
25: ErrUnknownMemberID,
26: ErrInvalidSessionTimeout,
27: ErrRebalanceInProgress,
28: ErrInvalidCommitOffsetSize,
29: ErrTopicAuthorizationFailed,
30: ErrGroupAuthorizationFailed,
31: ErrClusterAuthorizationFailed,
}