Nice error messages if VBoxManage command fails

This commit is contained in:
Mitchell Hashimoto 2011-12-21 15:41:14 -08:00
parent 0aae0dd588
commit 306945dd26
3 changed files with 13 additions and 2 deletions

View File

@ -267,8 +267,7 @@ module Vagrant
# If the command was a failure, then raise an exception that is
# nicely handled by Vagrant.
if r.exit_code != 0
# TODO: Inherit from VagrantError
raise Exception, "FAILURE: #{r.stderr}"
raise Errors::VBoxManageError, :command => command.inspect
end
# Return the output

View File

@ -300,6 +300,11 @@ module Vagrant
error_key(:vagrantfile_syntax_error)
end
class VBoxManageError < VagrantError
status_code(59)
error_key(:vboxmanage_error)
end
class VirtualBoxInvalidVersion < VagrantError
status_code(17)
error_key(:virtualbox_invalid_version)

View File

@ -124,6 +124,13 @@ en:
message is reproduced below for convenience:
%{file}
vboxmanage_error: |-
There was an error executing the following command with VBoxManage:
%{command}
For more information on the failure, enable detailed logging with
VAGRANT_LOG.
virtualbox_invalid_version: |-
Vagrant has detected that you have VirtualBox version %{version} installed!
Vagrant requires that you use at least VirtualBox version 4.1. Please install