foreman_maintain/lib/foreman_maintain/error.rb @ 181810b0
38a0b341 | Swapnil Abnave | module ForemanMaintain
|
|
module Error
|
|||
class Fail < StandardError
|
|||
end
|
|||
d04bc928 | Swapnil Abnave | ||
class Warn < StandardError
|
|||
end
|
|||
e6f56dee | Ivan Nečas | ||
c418295c | Swapnil Abnave | class MultipleBeforeDetected < StandardError
|
|
def initialize(step_labels)
|
|||
@step_labels = step_labels
|
|||
end
|
|||
def message
|
|||
"multiple metadata detected instead of 1. \n before [#{@step_labels.join(', ')}]\n"
|
|||
end
|
|||
end
|
|||
e6f56dee | Ivan Nečas | class ExecutionError < StandardError
|
|
attr_reader :command, :input, :output, :exit_status
|
|||
def initialize(command, exit_status, input, output)
|
|||
@command = command
|
|||
@exit_status = exit_status
|
|||
@input = input
|
|||
@output = output
|
|||
super(generate_message)
|
|||
end
|
|||
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
|
|||
end
|
|||
181810b0 | Ivan Nečas | ||
# Error caused by incorrect usage, usually connected to passed CLI options
|
|||
class UsageError < StandardError
|
|||
end
|
|||
38a0b341 | Swapnil Abnave | end
|
|
end
|