diff --git a/CHANGELOG.md b/CHANGELOG.md index ec8b3f5a7..116194a98 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -45,6 +45,8 @@ - SSH retries in the face of a `EHOSTUNREACH` error, improving the robustness that SSHing succeeds when booting a machine. - Add missing translation for "saving" state on VirtualBox. [GH-1110] + - Proper error message if the remote end unexpectedly resets the connection + while downloading a box over HTTP. [GH-1090] ## 1.0.3 (May 1, 2012) diff --git a/lib/vagrant/downloaders/http.rb b/lib/vagrant/downloaders/http.rb index 5e4d10cbb..0b63a38d8 100644 --- a/lib/vagrant/downloaders/http.rb +++ b/lib/vagrant/downloaders/http.rb @@ -69,6 +69,8 @@ module Vagrant @ui.clear_line end end + rescue Errno::ECONNRESET + raise Errors::DownloaderHTTPConnectReset rescue Errno::ETIMEDOUT raise Errors::DownloaderHTTPConnectTimeout rescue SocketError diff --git a/lib/vagrant/errors.rb b/lib/vagrant/errors.rb index 69d6c5163..1afb29b25 100644 --- a/lib/vagrant/errors.rb +++ b/lib/vagrant/errors.rb @@ -171,6 +171,10 @@ module Vagrant error_key(:file_missing, "vagrant.downloaders.file") end + class DownloaderHTTPConnectReset < VagrantError + error_key(:connection_reset, "vagrant.downloaders.http") + end + class DownloaderHTTPConnectTimeout < VagrantError status_code(79) error_key(:connection_timeout, "vagrant.downloaders.http") diff --git a/templates/locales/en.yml b/templates/locales/en.yml index c10f3f99c..2cd9e3be4 100644 --- a/templates/locales/en.yml +++ b/templates/locales/en.yml @@ -630,6 +630,11 @@ en: download: "Copying box to temporary location..." file_missing: "The specified path to a file doesn't exist." http: + connection_reset: |- + The remote server unexpectedly closed the connection. Vagrant was + unable to finish downloading the box. Please try again. If this + problem persists, please try downloading the box manually outside + of Vagrant, then adding the box from the filesystem. connection_timeout: |- Vagrant timed out while attempting to connect to the HTTP host. Please check your internet and proxy settings and try again.