Exception: RabbitMQ::ServerError

Inherits:
RuntimeError
  • Object
show all
Defined in:
lib/rabbitmq/server_error.rb

Direct Known Subclasses

ChannelError, ConnectionError

Defined Under Namespace

Classes: ChannelError, ConnectionError

Class Attribute Summary collapse

Instance Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.lookup_tableObject (readonly)

Returns the value of attribute lookup_table.



5
6
7
# File 'lib/rabbitmq/server_error.rb', line 5

def lookup_table
  @lookup_table
end

Instance Attribute Details

#event=(value) ⇒ Object (writeonly)

Sets the attribute event

Parameters:

  • value

    the value to set the attribute event to.



23
24
25
# File 'lib/rabbitmq/server_error.rb', line 23

def event=(value)
  @event = value
end

Class Method Details

.from(event) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/rabbitmq/server_error.rb', line 8

def self.from(event)
  properties = event.fetch(:properties)
  kls = case event.fetch(:method)
  when :channel_close
    ChannelError.lookup_table[properties.fetch(:reply_code)]
  when :connection_close
    ConnectionError.lookup_table[properties.fetch(:reply_code)]
  else
    return
  end
  exc = kls.new(properties.fetch(:reply_text))
  exc.event = event
  exc
end