class Deltacloud::Exceptions::ExceptionDef

Attributes

conditions[R]
handler[R]
message[RW]
status[RW]

Public Class Methods

new(conditions, &block) click to toggle source
# File lib/deltacloud/drivers/exceptions.rb, line 129
def initialize(conditions, &block)
  @conditions = conditions
  instance_eval(&block) if block_given?
  self
end

Public Instance Methods

any?(e) click to toggle source

Condition can be class or regexp

# File lib/deltacloud/drivers/exceptions.rb, line 149
def any?(e)
  @conditions.each do |c|
    return true if c.class == Class && e.class == c
    return true if c.class == Regexp && (e.class.name =~ c or e.message =~ c)
  end
  return false
end
exception(handler) click to toggle source
# File lib/deltacloud/drivers/exceptions.rb, line 143
def exception(handler)
  self.handler = handler
end