@@ -16,21 +16,44 @@ def __str__(self):
16
16
super (KafkaError , self ).__str__ ())
17
17
18
18
19
+ class Cancelled (KafkaError ):
20
+ retriable = True
21
+
22
+
23
+ class CommitFailedError (KafkaError ):
24
+ def __init__ (self , * args , ** kwargs ):
25
+ super (CommitFailedError , self ).__init__ (
26
+ """Commit cannot be completed since the group has already
27
+ rebalanced and assigned the partitions to another member.
28
+ This means that the time between subsequent calls to poll()
29
+ was longer than the configured max_poll_interval_ms, which
30
+ typically implies that the poll loop is spending too much
31
+ time message processing. You can address this either by
32
+ increasing the rebalance timeout with max_poll_interval_ms,
33
+ or by reducing the maximum size of batches returned in poll()
34
+ with max_poll_records.
35
+ """ , * args , ** kwargs )
36
+
37
+
38
+ class IllegalArgumentError (KafkaError ):
39
+ pass
40
+
41
+
19
42
class IllegalStateError (KafkaError ):
20
43
pass
21
44
22
45
23
- class IllegalArgumentError (KafkaError ):
46
+ class IncompatibleBrokerVersion (KafkaError ):
24
47
pass
25
48
26
49
27
- class NoBrokersAvailable (KafkaError ):
28
- retriable = True
29
- invalid_metadata = True
50
+ class KafkaConfigurationError (KafkaError ):
51
+ pass
30
52
31
53
32
- class NodeNotReadyError (KafkaError ):
54
+ class KafkaConnectionError (KafkaError ):
33
55
retriable = True
56
+ invalid_metadata = True
34
57
35
58
36
59
class KafkaProtocolError (KafkaError ):
@@ -41,47 +64,41 @@ class CorrelationIdError(KafkaProtocolError):
41
64
retriable = True
42
65
43
66
44
- class Cancelled (KafkaError ):
67
+ class KafkaTimeoutError (KafkaError ):
45
68
retriable = True
46
69
47
70
48
- class TooManyInFlightRequests (KafkaError ):
71
+ class MetadataEmptyBrokerList (KafkaError ):
49
72
retriable = True
50
73
51
74
52
- class StaleMetadata (KafkaError ):
75
+ class NoBrokersAvailable (KafkaError ):
53
76
retriable = True
54
77
invalid_metadata = True
55
78
56
79
57
- class MetadataEmptyBrokerList (KafkaError ):
80
+ class NodeNotReadyError (KafkaError ):
58
81
retriable = True
59
82
60
83
61
- class UnrecognizedBrokerVersion (KafkaError ):
84
+ class QuotaViolationError (KafkaError ):
62
85
pass
63
86
64
87
65
- class IncompatibleBrokerVersion (KafkaError ):
66
- pass
88
+ class StaleMetadata (KafkaError ):
89
+ retriable = True
90
+ invalid_metadata = True
67
91
68
92
69
- class CommitFailedError (KafkaError ):
70
- def __init__ (self , * args , ** kwargs ):
71
- super (CommitFailedError , self ).__init__ (
72
- """Commit cannot be completed since the group has already
73
- rebalanced and assigned the partitions to another member.
74
- This means that the time between subsequent calls to poll()
75
- was longer than the configured max_poll_interval_ms, which
76
- typically implies that the poll loop is spending too much
77
- time message processing. You can address this either by
78
- increasing the rebalance timeout with max_poll_interval_ms,
79
- or by reducing the maximum size of batches returned in poll()
80
- with max_poll_records.
81
- """ , * args , ** kwargs )
93
+ class TooManyInFlightRequests (KafkaError ):
94
+ retriable = True
95
+
82
96
97
+ class UnrecognizedBrokerVersion (KafkaError ):
98
+ pass
83
99
84
- class AuthenticationMethodNotSupported (KafkaError ):
100
+
101
+ class UnsupportedCodecError (KafkaError ):
85
102
pass
86
103
87
104
@@ -97,6 +114,10 @@ def __str__(self):
97
114
super (BrokerResponseError , self ).__str__ ())
98
115
99
116
117
+ class AuthorizationError (BrokerResponseError ):
118
+ pass
119
+
120
+
100
121
class NoError (BrokerResponseError ):
101
122
errno = 0
102
123
message = 'NO_ERROR'
@@ -332,21 +353,21 @@ class InvalidCommitOffsetSizeError(BrokerResponseError):
332
353
' because of oversize metadata.' )
333
354
334
355
335
- class TopicAuthorizationFailedError (BrokerResponseError ):
356
+ class TopicAuthorizationFailedError (AuthorizationError ):
336
357
errno = 29
337
358
message = 'TOPIC_AUTHORIZATION_FAILED'
338
359
description = ('Returned by the broker when the client is not authorized to'
339
360
' access the requested topic.' )
340
361
341
362
342
- class GroupAuthorizationFailedError (BrokerResponseError ):
363
+ class GroupAuthorizationFailedError (AuthorizationError ):
343
364
errno = 30
344
365
message = 'GROUP_AUTHORIZATION_FAILED'
345
366
description = ('Returned by the broker when the client is not authorized to'
346
367
' access a particular groupId.' )
347
368
348
369
349
- class ClusterAuthorizationFailedError (BrokerResponseError ):
370
+ class ClusterAuthorizationFailedError (AuthorizationError ):
350
371
errno = 31
351
372
message = 'CLUSTER_AUTHORIZATION_FAILED'
352
373
description = ('Returned by the broker when the client is not authorized to'
@@ -493,7 +514,7 @@ class TransactionCoordinatorFencedError(BrokerResponseError):
493
514
retriable = False
494
515
495
516
496
- class TransactionalIdAuthorizationFailedError (BrokerResponseError ):
517
+ class TransactionalIdAuthorizationFailedError (AuthorizationError ):
497
518
errno = 53
498
519
message = 'TRANSACTIONAL_ID_AUTHORIZATION_FAILED'
499
520
description = 'Transactional Id authorization failed.'
@@ -578,7 +599,7 @@ class DelegationTokenRequestNotAllowedError(BrokerResponseError):
578
599
retriable = False
579
600
580
601
581
- class DelegationTokenAuthorizationFailedError (BrokerResponseError ):
602
+ class DelegationTokenAuthorizationFailedError (AuthorizationError ):
582
603
errno = 65
583
604
message = 'DELEGATION_TOKEN_AUTHORIZATION_FAILED'
584
605
description = 'Delegation Token authorization failed.'
@@ -1027,47 +1048,6 @@ class VoterNotFoundError(BrokerResponseError):
1027
1048
retriable = False
1028
1049
1029
1050
1030
- class KafkaUnavailableError (KafkaError ):
1031
- pass
1032
-
1033
-
1034
- class KafkaTimeoutError (KafkaError ):
1035
- pass
1036
-
1037
-
1038
- class FailedPayloadsError (KafkaError ):
1039
- def __init__ (self , payload , * args ):
1040
- super (FailedPayloadsError , self ).__init__ (* args )
1041
- self .payload = payload
1042
-
1043
-
1044
- class KafkaConnectionError (KafkaError ):
1045
- retriable = True
1046
- invalid_metadata = True
1047
-
1048
-
1049
- class ProtocolError (KafkaError ):
1050
- pass
1051
-
1052
-
1053
- class UnsupportedCodecError (KafkaError ):
1054
- pass
1055
-
1056
-
1057
- class KafkaConfigurationError (KafkaError ):
1058
- pass
1059
-
1060
-
1061
- class QuotaViolationError (KafkaError ):
1062
- pass
1063
-
1064
-
1065
- class AsyncProducerQueueFull (KafkaError ):
1066
- def __init__ (self , failed_msgs , * args ):
1067
- super (AsyncProducerQueueFull , self ).__init__ (* args )
1068
- self .failed_msgs = failed_msgs
1069
-
1070
-
1071
1051
def _iter_broker_errors ():
1072
1052
for name , obj in inspect .getmembers (sys .modules [__name__ ]):
1073
1053
if inspect .isclass (obj ) and issubclass (obj , BrokerResponseError ) and obj != BrokerResponseError :
0 commit comments