Show nice error message for bad HTTP downloads [closes GH-403]
This commit is contained in:
parent
487e6a1c21
commit
dcaca22810
|
@ -3,6 +3,8 @@
|
||||||
- Performance optimizations in `virtualbox` gem. Huge speed gains.
|
- Performance optimizations in `virtualbox` gem. Huge speed gains.
|
||||||
- `:chef_server` provisioner is now `:chef_client`. [GH-359]
|
- `:chef_server` provisioner is now `:chef_client`. [GH-359]
|
||||||
- SUSE host only networking support. [GH-369]
|
- SUSE host only networking support. [GH-369]
|
||||||
|
- Show nice error message for invalid HTTP responses for HTTP
|
||||||
|
downloader. [GH-403]
|
||||||
|
|
||||||
## 0.7.6 (July 2, 2011)
|
## 0.7.6 (July 2, 2011)
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,8 @@ module Vagrant
|
||||||
# TODO: Error on some redirect limit
|
# TODO: Error on some redirect limit
|
||||||
download!(response["Location"], destination_file)
|
download!(response["Location"], destination_file)
|
||||||
return
|
return
|
||||||
|
elsif !response.is_a?(Net::HTTPOK)
|
||||||
|
raise Errors::DownloaderHTTPStatusError, :status => response.code
|
||||||
end
|
end
|
||||||
|
|
||||||
total = response.content_length
|
total = response.content_length
|
||||||
|
|
|
@ -148,6 +148,11 @@ module Vagrant
|
||||||
error_key(:socket_error, "vagrant.downloaders.http")
|
error_key(:socket_error, "vagrant.downloaders.http")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
class DownloaderHTTPStatusError < VagrantError
|
||||||
|
status_code(51)
|
||||||
|
error_key(:status_error, "vagrant.downloaders.http")
|
||||||
|
end
|
||||||
|
|
||||||
class ForwardPortAutolistEmpty < VagrantError
|
class ForwardPortAutolistEmpty < VagrantError
|
||||||
status_code(27)
|
status_code(27)
|
||||||
error_key(:auto_empty, "vagrant.actions.vm.forward_ports")
|
error_key(:auto_empty, "vagrant.actions.vm.forward_ports")
|
||||||
|
|
|
@ -448,6 +448,11 @@ en:
|
||||||
An error occurred while trying to download the specified box. This most
|
An error occurred while trying to download the specified box. This most
|
||||||
often happens if there is no internet connection or the address is
|
often happens if there is no internet connection or the address is
|
||||||
invalid.
|
invalid.
|
||||||
|
status_error: |-
|
||||||
|
Bad status code: %{status}
|
||||||
|
|
||||||
|
Please verify that the box exists and is accessible. Also verify that
|
||||||
|
this computer is properly connected to the internet.
|
||||||
|
|
||||||
hosts:
|
hosts:
|
||||||
bsd:
|
bsd:
|
||||||
|
|
|
@ -42,6 +42,8 @@ class HttpDownloaderTest < Test::Unit::TestCase
|
||||||
h = mock("http")
|
h = mock("http")
|
||||||
response = mock("response")
|
response = mock("response")
|
||||||
response.stubs(:content_length)
|
response.stubs(:content_length)
|
||||||
|
response.stubs(:is_a?).with(anything).returns(false)
|
||||||
|
response.stubs(:is_a?).with(Net::HTTPOK).returns(true)
|
||||||
segment = mock("segment")
|
segment = mock("segment")
|
||||||
segment.stubs(:length).returns(7)
|
segment.stubs(:length).returns(7)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue