Exception: Yapo::Helpers::CustomErrors::CommandError

Inherits:
RuntimeError
  • Object
show all
Defined in:
lib/yapo/helpers/custom_errors.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(command, result, *args) ⇒ CommandError

Returns a new instance of CommandError.



47
48
49
50
51
52
53
54
# File 'lib/yapo/helpers/custom_errors.rb', line 47

def initialize(command, result, *args)
  @command = command
  @params = *args
  @exit_status = result.exit_status
  @out = result.out
  @err = result.err
  ErrorMessage.new.print(message)
end

Instance Attribute Details

#errObject (readonly)

Returns the value of attribute err.



45
46
47
# File 'lib/yapo/helpers/custom_errors.rb', line 45

def err
  @err
end

#exit_statusObject (readonly)

Returns the value of attribute exit_status.



45
46
47
# File 'lib/yapo/helpers/custom_errors.rb', line 45

def exit_status
  @exit_status
end

#outObject (readonly)

Returns the value of attribute out.



45
46
47
# File 'lib/yapo/helpers/custom_errors.rb', line 45

def out
  @out
end

#paramsObject (readonly)

Returns the value of attribute params.



45
46
47
# File 'lib/yapo/helpers/custom_errors.rb', line 45

def params
  @params
end

Instance Method Details

#messageObject



56
57
58
59
60
61
62
# File 'lib/yapo/helpers/custom_errors.rb', line 56

def message
  "The command you are tying to execute is not valid. Please verify it works in your terminal first.\n" \
  "Running \"#{@command}\" failed with exit status #{@exit_status}.\n" \
  "  params: #{@params}\n" \
  "  std out: #{@out}\n" \
  "  std err: #{@err}\n"
end