def __init__(self, error_code, exception=None): if exception is not None: kafka_error = KafkaError(error_code, repr(exception)) self.exception = exception else: kafka_error = KafkaError(error_code) super(ProduceError, self).__init__(kafka_error) self.__error = kafka_error
def __init__(self, error_code, exception=None, message=None): if exception is not None: kafka_error = KafkaError(error_code, repr(exception)) self.exception = exception else: kafka_error = KafkaError(error_code) self.exception = None super(ConsumeError, self).__init__(kafka_error) self.message = message
def __init__(self, exception=None, message=None): code = KafkaError._TIMED_OUT if exception is not None: kafka_error = KafkaError(code, repr(exception)) self.exception = exception else: kafka_error = KafkaError(code) super().__init__(kafka_error) self.__message = message self.__error = kafka_error
def error_message_factory_(error_code=None): error = KafkaError() error.code.return_value = error_code return message_factory(error=error)
def __init__(self, exception=None, kafka_message=None): super(KeyDeserializationError, self).__init__(KafkaError(KafkaError._KEY_DESERIALIZATION, str(exception)), exception=exception, kafka_message=kafka_message)
def __init__(self, exception=None): super(ValueSerializationError, self).__init__(KafkaError(KafkaError._VALUE_SERIALIZATION, str(exception)), exception=exception)
def _on_error(self, error: KafkaError): logger.error(error.str(), extra=dict(error_code=error.code(), error_name=error.name())) if self.error_callback: self.error_callback(error)
def __init__(self, exception=None): super(KeySerializationError, self).__init__( KafkaError(KafkaError._KEY_SERIALIZATION, str(exception)), exception=exception, )