def handle_failed_jobs(jobs)
      failed_jobs = jobs.select { |j| !j.exception.nil? }
      return if failed_jobs.empty?
      if jobs.length == 1
        # Don't provide a bad UX by showing a 'one or more jobs has failed'
        # message when there was only one job.
        raise jobs.first.exception
      end
      raise ChefApply::MultiJobFailure.new(failed_jobs)
    end
def handle_failed_jobs(jobs)
      failed_jobs = jobs.select { |j| !j.exception.nil? }
      return if failed_jobs.empty?
      if jobs.length == 1
        # Don't provide a bad UX by showing a 'one or more jobs has failed'
        # message when there was only one job.
        raise jobs.first.exception
      end
      raise ChefApply::MultiJobFailure.new(failed_jobs)
    end
When running multiple jobs, exceptions are captured to the
 job to avoid interrupting other jobs in process.  This function
 collects them and raises directly (in the case of just one job in the list)
 or raises a MultiJobFailure (when more than one job was being run)