Exception: ForemanTasks::TaskError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/foreman_tasks/task_error.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(task) ⇒ TaskError

Returns a new instance of TaskError.



6
7
8
9
10
# File 'lib/foreman_tasks/task_error.rb', line 6

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

Instance Attribute Details

#errorsObject (readonly)

Returns the value of attribute errors.



4
5
6
# File 'lib/foreman_tasks/task_error.rb', line 4

def errors
  @errors
end

#taskObject (readonly)

Returns the value of attribute task.



3
4
5
# File 'lib/foreman_tasks/task_error.rb', line 3

def task
  @task
end

Instance Method Details

#aggregated_messageObject



12
13
14
15
# File 'lib/foreman_tasks/task_error.rb', line 12

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