Exception: Rdkafka::RdkafkaError
- Defined in:
- lib/rdkafka/error.rb
Overview
Error returned by the underlying rdkafka library.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#broker_message ⇒ String
readonly
Error message sent by the broker.
-
#message_prefix ⇒ String
readonly
Prefix to be used for human readable representation.
-
#rdkafka_response ⇒ Integer
readonly
The underlying raw error response.
Instance Method Summary collapse
-
#==(another_error) ⇒ Object
Error comparison.
-
#code ⇒ Symbol
This error's code, for example
:partition_eof
,:msg_size_too_large
. -
#is_partition_eof? ⇒ Boolean
Whether this error indicates the partition is EOF.
-
#to_s ⇒ String
Human readable representation of this error.
Instance Attribute Details
#broker_message ⇒ String (readonly)
Error message sent by the broker
17 18 19 |
# File 'lib/rdkafka/error.rb', line 17 def @broker_message end |
#message_prefix ⇒ String (readonly)
Prefix to be used for human readable representation
13 14 15 |
# File 'lib/rdkafka/error.rb', line 13 def @message_prefix end |
#rdkafka_response ⇒ Integer (readonly)
The underlying raw error response
9 10 11 |
# File 'lib/rdkafka/error.rb', line 9 def rdkafka_response @rdkafka_response end |
Instance Method Details
#==(another_error) ⇒ Object
Error comparison
56 57 58 |
# File 'lib/rdkafka/error.rb', line 56 def ==(another_error) another_error.is_a?(self.class) && (self.to_s == another_error.to_s) end |
#code ⇒ Symbol
This error's code, for example :partition_eof
, :msg_size_too_large
.
29 30 31 32 33 34 35 36 |
# File 'lib/rdkafka/error.rb', line 29 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.
51 52 53 |
# File 'lib/rdkafka/error.rb', line 51 def is_partition_eof? code == :partition_eof end |
#to_s ⇒ String
Human readable representation of this error.
40 41 42 43 44 45 46 47 |
# File 'lib/rdkafka/error.rb', line 40 def to_s = if "#{} - " else '' end "#{}#{Rdkafka::Bindings.rd_kafka_err2str(@rdkafka_response)} (#{code})" end |