Exception: ForemanMaintain::Error::ExecutionError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/foreman_maintain/error.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(command, exit_status, input, output) ⇒ ExecutionError

Returns a new instance of ExecutionError.



28
29
30
31
32
33
34
# File 'lib/foreman_maintain/error.rb', line 28

def initialize(command, exit_status, input, output)
  @command = command
  @exit_status = exit_status
  @input = input
  @output = output
  super(generate_message)
end

Instance Attribute Details

#commandObject (readonly)

Returns the value of attribute command.



26
27
28
# File 'lib/foreman_maintain/error.rb', line 26

def command
  @command
end

#exit_statusObject (readonly)

Returns the value of attribute exit_status.



26
27
28
# File 'lib/foreman_maintain/error.rb', line 26

def exit_status
  @exit_status
end

#inputObject (readonly)

Returns the value of attribute input.



26
27
28
# File 'lib/foreman_maintain/error.rb', line 26

def input
  @input
end

#outputObject (readonly)

Returns the value of attribute output.



26
27
28
# File 'lib/foreman_maintain/error.rb', line 26

def output
  @output
end

Instance Method Details

#generate_messageObject



36
37
38
39
40
41
# File 'lib/foreman_maintain/error.rb', line 36

def generate_message
  ret = "Failed executing #{command}, exit status #{exit_status}"
  ret << "with input '#{input}'" if input
  ret << ":\n #{output}" if output && !output.empty?
  ret
end