# File lib/deltacloud/drivers/exceptions.rb, line 115 def initialize(conditions, &block) @conditions = conditions instance_eval(&block) if block_given? end
# File lib/deltacloud/drivers/exceptions.rb, line 128 def exception(handler) self.handler = handler end
Condition can be class or regexp
# File lib/deltacloud/drivers/exceptions.rb, line 134 def match?(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