# class Chef::Exceptions::MultipleFailures

Exception class for collecting multiple failures. Used when running delayed notifications so that chef can process each delayed notification even if chef client or other notifications fail.

### Public Class Methods

new(*args) click to toggle source
Calls superclass method

    # File lib/chef/exceptions.rb, line 202
    def initialize(*args)
      super
      @all_failures = []
    end

### Public Instance Methods

client_run_failure(exception) click to toggle source

    # File lib/chef/exceptions.rb, line 214
    def client_run_failure(exception)
      set_backtrace(exception.backtrace)
      @all_failures << [ "chef run", exception ]
    end

empty?() click to toggle source

    # File lib/chef/exceptions.rb, line 229
    def empty?
      @all_failures.empty?
    end

for_raise() click to toggle source

    # File lib/chef/exceptions.rb, line 233
    def for_raise
      if @all_failures.size == 1
        @all_failures[0][1]
      else
        self
      end
    end

message() click to toggle source

    # File lib/chef/exceptions.rb, line 207
    def message
      base = "Multiple failures occurred:\n"
      @all_failures.inject(base) do |message, (location, error)|
        message << "* #{error.class} occurred in #{location}: #{error.message}\n"
      end
    end

notification_failure(exception) click to toggle source

    # File lib/chef/exceptions.rb, line 219
    def notification_failure(exception)
      @all_failures << [ "delayed notification", exception ]
    end

raise!() click to toggle source

    # File lib/chef/exceptions.rb, line 223
    def raise!
      unless empty?
        raise self.for_raise
      end
    end