Sha256: 0ee4dd953d51ddc2cc31fd03d86f83b813ebe143af34650250daf381d5df5a0d

Contents?: true

Size: 408 Bytes

Versions: 61

Compression:

Stored size: 408 Bytes

Contents

module ForemanTasks
  class TaskError < StandardError

    attr_reader :task
    attr_reader :errors

    def initialize(task)
      @task = task
      @errors = task.execution_plan.steps.values.map(&:error).compact
      super(aggregated_message)
    end

    def aggregated_message
      "Task #{task.id}: " +
          errors.map { |e| "#{e.exception_class}: #{e.message}" }.join('; ')
    end

  end
end

Version data entries

61 entries across 61 versions & 1 rubygems

Version Path
foreman-tasks-0.2.2 lib/foreman_tasks/task_error.rb