Exception: Bosh::Exec::Error

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

Overview

Raised when there was an error executing the command

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(status, command, output = nil) ⇒ Error

Returns a new instance of Error.



8
9
10
11
12
# File 'lib/common/exec/error.rb', line 8

def initialize(status, command, output=nil)
  @status = status
  @command = command
  @output = output
end

Instance Attribute Details

#outputObject (readonly)

Returns the value of attribute output.



6
7
8
# File 'lib/common/exec/error.rb', line 6

def output
  @output
end

Instance Method Details

#messageObject



14
15
16
17
18
19
20
# File 'lib/common/exec/error.rb', line 14

def message
  if @status
    "command '#{@command}' failed with exit code #{@status}"
  else
    "command not found: #{@command}"
  end
end

#to_sObject



22
23
24
# File 'lib/common/exec/error.rb', line 22

def to_s
  message
end