Exception: VirtualBox::Error

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

Overview

Raised when the VirtualBox CLI returns a non-zero error code.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(cli_result) ⇒ Error

Called by raise.

Parameters:

  • cli_result (Hash<Symbol, Object>)

    the return value of a VirtualBox.run call.



17
18
19
20
21
22
# File 'lib/virtual_box/error.rb', line 17

def initialize(cli_result)
  @exit_code = cli_result[:status]
  @output = cli_result[:output]
  
  super "VirtualBox CLI exited with code #{@exit_code}:\n#{@output}\n"
end

Instance Attribute Details

#exit_codeInteger (readonly)

The exit code of the failed VirtualBox command.

Returns:

  • (Integer)


7
8
9
# File 'lib/virtual_box/error.rb', line 7

def exit_code
  @exit_code
end

#outputString (readonly)

The combined stdout and stderr of the failed VirtualBox command.

Returns:

  • (String)


11
12
13
# File 'lib/virtual_box/error.rb', line 11

def output
  @output
end