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.6.3 lib/foreman_tasks/task_error.rb
foreman-tasks-0.6.2 lib/foreman_tasks/task_error.rb
foreman-tasks-0.6.1 lib/foreman_tasks/task_error.rb
foreman-tasks-0.6.0 lib/foreman_tasks/task_error.rb
foreman-tasks-0.5.7 lib/foreman_tasks/task_error.rb
foreman-tasks-0.5.6 lib/foreman_tasks/task_error.rb
foreman-tasks-0.5.5 lib/foreman_tasks/task_error.rb
foreman-tasks-0.5.4 lib/foreman_tasks/task_error.rb
foreman-tasks-0.5.3 lib/foreman_tasks/task_error.rb
foreman-tasks-0.5.2 lib/foreman_tasks/task_error.rb
foreman-tasks-0.5.1 lib/foreman_tasks/task_error.rb
foreman-tasks-0.5.0 lib/foreman_tasks/task_error.rb
foreman-tasks-0.4.0 lib/foreman_tasks/task_error.rb
foreman-tasks-0.3.6 lib/foreman_tasks/task_error.rb
foreman-tasks-0.3.5 lib/foreman_tasks/task_error.rb
foreman-tasks-0.3.4 lib/foreman_tasks/task_error.rb
foreman-tasks-0.3.3 lib/foreman_tasks/task_error.rb
foreman-tasks-0.3.2 lib/foreman_tasks/task_error.rb
foreman-tasks-0.3.1 lib/foreman_tasks/task_error.rb
foreman-tasks-0.3.0 lib/foreman_tasks/task_error.rb