15
15
from kafka .coordinator .protocol import ConsumerProtocolMemberMetadata , ConsumerProtocolMemberAssignment , ConsumerProtocol
16
16
import kafka .errors as Errors
17
17
from kafka .errors import (
18
- IncompatibleBrokerVersion , KafkaConfigurationError , NotControllerError , UnknownTopicOrPartitionError ,
18
+ IncompatibleBrokerVersion , KafkaConfigurationError , UnknownTopicOrPartitionError ,
19
19
UnrecognizedBrokerVersion , IllegalArgumentError )
20
20
from kafka .metrics import MetricConfig , Metrics
21
21
from kafka .protocol .admin import (
@@ -411,7 +411,7 @@ def _parse_topic_request_response(self, topic_error_tuples, request, response, t
411
411
# extra values (usually the error_message)
412
412
for topic , error_code in map (lambda e : e [:2 ], topic_error_tuples ):
413
413
error_type = Errors .for_code (error_code )
414
- if tries and error_type is NotControllerError :
414
+ if tries and error_type is Errors . NotControllerError :
415
415
# No need to inspect the rest of the errors for
416
416
# non-retriable errors because NotControllerError should
417
417
# either be thrown for all errors or no errors.
@@ -431,13 +431,13 @@ def _parse_topic_partition_request_response(self, request, response, tries):
431
431
for topic , partition_results in response .replication_election_results :
432
432
for partition_id , error_code in map (lambda e : e [:2 ], partition_results ):
433
433
error_type = Errors .for_code (error_code )
434
- if tries and error_type is NotControllerError :
434
+ if tries and error_type is Errors . NotControllerError :
435
435
# No need to inspect the rest of the errors for
436
436
# non-retriable errors because NotControllerError should
437
437
# either be thrown for all errors or no errors.
438
438
self ._refresh_controller_id ()
439
439
return False
440
- elif error_type not in [ Errors .NoError , Errors .ElectionNotNeeded ] :
440
+ elif error_type not in ( Errors .NoError , Errors .ElectionNotNeededError ) :
441
441
raise error_type (
442
442
"Request '{}' failed with response '{}'."
443
443
.format (request , response ))
0 commit comments