Exception: Rdkafka::RdkafkaError

Inherits:
RuntimeError
  • Object
show all
Defined in:
lib/rdkafka/error.rb

Overview

Error returned by the underlying rdkafka library.

Direct Known Subclasses

RdkafkaTopicPartitionListError

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#message_prefixInteger (readonly)

The underlying raw error response

Returns:

  • (Integer)


6
7
8
# File 'lib/rdkafka/error.rb', line 6

def message_prefix
  @message_prefix
end

#rdkafka_responseInteger (readonly)

The underlying raw error response

Returns:

  • (Integer)


6
7
8
# File 'lib/rdkafka/error.rb', line 6

def rdkafka_response
  @rdkafka_response
end

Instance Method Details

#codeSymbol

This error's code, for example :partition_eof, :msg_size_too_large.

Returns:

  • (Symbol)


17
18
19
20
21
22
23
24
# File 'lib/rdkafka/error.rb', line 17

def code
  code = Rdkafka::Bindings.rd_kafka_err2name(@rdkafka_response).downcase
  if code[0] == "_"
    code[1..-1].to_sym
  else
    code.to_sym
  end
end

#is_partition_eof?Boolean

Whether this error indicates the partition is EOF.

Returns:

  • (Boolean)


39
40
41
# File 'lib/rdkafka/error.rb', line 39

def is_partition_eof?
  code == :partition_eof
end

#to_sString

Human readable representation of this error.

Returns:

  • (String)


28
29
30
31
32
33
34
35
# File 'lib/rdkafka/error.rb', line 28

def to_s
  message_prefix_part = if message_prefix
                   "#{message_prefix} - "
                 else
                   ''
                 end
  "#{message_prefix_part}#{Rdkafka::Bindings.rd_kafka_err2str(@rdkafka_response)} (#{code})"
end