Exception: Kafka::ResponseError
- Defined in:
 - lib/kafka/error.rb
 
Overview
::Kafka::ResponseError is an Error that can be raised based on an :error_code as returned from the librdkafka API.
Instance Attribute Summary collapse
- #code ⇒ Object readonly
 
Instance Method Summary collapse
- 
  
    
      #initialize(code, message = nil)  ⇒ ResponseError 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    
A new instance of ResponseError.
 - 
  
    
      #internal?  ⇒ true, false 
    
    
  
  
  
  
  
  
  
  
  
    
Returns true when the error is from internal to librdkafka or false when the error was received from a broker or timeout.
 - 
  
    
      #name  ⇒ String 
    
    
  
  
  
  
  
  
  
  
  
    
Returns the librdkafka error constant for this error.
 - 
  
    
      #to_s  ⇒ String 
    
    
  
  
  
  
  
  
  
  
  
    
Returns a human readable error description.
 
Constructor Details
#initialize(code, message = nil) ⇒ ResponseError
Returns a new instance of ResponseError.
      15 16 17 18  | 
    
      # File 'lib/kafka/error.rb', line 15 def initialize(code, message = nil) @code = code @message = message end  | 
  
Instance Attribute Details
#code ⇒ Object (readonly)
      13 14 15  | 
    
      # File 'lib/kafka/error.rb', line 13 def code @code end  | 
  
Instance Method Details
#internal? ⇒ true, false
Returns true when the error is from internal to librdkafka or false when the error was received from a broker or timeout.
      33 34 35  | 
    
      # File 'lib/kafka/error.rb', line 33 def internal? code < 0 end  | 
  
#name ⇒ String
Returns the librdkafka error constant for this error.
      22 23 24  | 
    
      # File 'lib/kafka/error.rb', line 22 def name "RD_KAFKA_RESP_ERR_#{::Kafka::FFI.rd_kafka_err2name(@code)}" end  | 
  
#to_s ⇒ String
Returns a human readable error description
      40 41 42  | 
    
      # File 'lib/kafka/error.rb', line 40 def to_s @message || ::Kafka::FFI.rd_kafka_err2str(@code) end  |