Class/Module Index [+]

Quicksearch

Deltacloud::ExceptionHandler

Public Class Methods

exceptions(&block) click to toggle source
# File lib/deltacloud/base_driver/exceptions.rb, line 144
def self.exceptions(&block)
  @definitions = Exceptions.new(&block).exception_definitions if block_given?
  @definitions
end

Public Instance Methods

safely(&block) click to toggle source
# File lib/deltacloud/base_driver/exceptions.rb, line 149
def safely(&block)
  begin
    block.call
  rescue
    report_method = $stderr.respond_to?(:err) ? :err : :puts
    Deltacloud::ExceptionHandler::exceptions.each do |exdef|
      if exdef.match?($!)
        $stderr.send(report_method, "#{[$!.class.to_s, $!.message].join(':')}\n#{$!.backtrace.join("\n")}")
        new_exception = exdef.handler($!)
        raise exdef.handler($!) if new_exception
      end
    end
    $stderr.send(report_method, "[NO HANDLED] #{[$!.class.to_s, $!.message].join(': ')}\n#{$!.backtrace.join("\n")}")
    raise Deltacloud::ExceptionHandler::BackendError.new($!, "Unhandled exception or status code (#{$!.message})")
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.