Exception: GorgonAMQ::Protocol::Error

Inherits:
StandardError
  • Object
show all
Defined in:
lib/gorgon_amq-protocol/lib/gorgon_amq/protocol/exceptions.rb

Constant Summary collapse

DEFAULT_MESSAGE =
"AMQP error".freeze

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message = self.class::DEFAULT_MESSAGE) ⇒ Error

self.[]



23
24
25
# File 'lib/gorgon_amq-protocol/lib/gorgon_amq/protocol/exceptions.rb', line 23

def initialize(message = self.class::DEFAULT_MESSAGE)
  super(message)
end

Class Method Details

.[](code) ⇒ Object

self.subclasses_with_values



15
16
17
18
19
20
21
# File 'lib/gorgon_amq-protocol/lib/gorgon_amq/protocol/exceptions.rb', line 15

def self.[](code)
  if result = subclasses_with_values.detect { |klass| klass::VALUE == code }
    result
  else
    raise "No such exception class for code #{code}" unless result
  end # if
end

.inherited(subclass) ⇒ Object



6
7
8
9
# File 'lib/gorgon_amq-protocol/lib/gorgon_amq/protocol/exceptions.rb', line 6

def self.inherited(subclass)
  @_subclasses ||= []
  @_subclasses << subclass
end

.subclasses_with_valuesObject

self.inherited(subclazz)



11
12
13
# File 'lib/gorgon_amq-protocol/lib/gorgon_amq/protocol/exceptions.rb', line 11

def self.subclasses_with_values
  @_subclasses.select{ |k| defined?(k::VALUE) }
end