communicators/ssh: nicer errors for SSH exceptions [GH-4367]

This commit is contained in:
Mitchell Hashimoto 2014-08-29 11:40:50 -07:00
parent a0b95cb927
commit be6665864d
3 changed files with 16 additions and 0 deletions

View File

@ -428,6 +428,10 @@ module Vagrant
error_key(:multi_vm_target_required)
end
class NetSSHException < VagrantError
error_key(:net_ssh_exception)
end
class NetworkCollision < VagrantError
error_key(:collides, "vagrant.actions.vm.host_only_network")
end

View File

@ -390,6 +390,9 @@ module VagrantPlugins
rescue Errno::EHOSTUNREACH
# This is raised if we can't work out how to route traffic.
raise Vagrant::Errors::SSHNoRoute
rescue Net::SSH::Exception => e
# This is an internal error in Net::SSH
raise Vagrant::Errors::NetSSHException, message: e.message
rescue NotImplementedError
# This is raised if a private key type that Net-SSH doesn't support
# is used. Show a nicer error.

View File

@ -799,6 +799,15 @@ en:
the proper location.
multi_vm_target_required: |-
This command requires a specific VM name to target in a multi-VM environment.
net_ssh_exception: |-
An error occurred in the underlying SSH library that Vagrant uses.
The error message is shown below. In many cases, errors from this
library are caused by ssh-agent issues. Try disabling your SSH
agent or removing some keys and try again.
If the problem persists, please report a bug to the net-ssh project.
%{message}
nfs_bad_exports: |-
NFS is reporting that your exports file is invalid. Vagrant does
this check before making any changes to the file. Please correct