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.



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

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

Instance Attribute Details

#outputObject (readonly)

Returns the value of attribute output.



4
5
6
# File 'lib/common/exec/error.rb', line 4

def output
  @output
end

Instance Method Details

#messageObject



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

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

#to_sObject



20
21
22
# File 'lib/common/exec/error.rb', line 20

def to_s
  message
end