diff options
author | Claire McQuin <claire@getchef.com> | 2014-01-23 16:57:47 -0800 |
---|---|---|
committer | Claire McQuin <claire@getchef.com> | 2014-01-23 16:57:47 -0800 |
commit | 963c3d55ce11f5d00a59b216e026d1bf87e7217a (patch) | |
tree | bfa44790eaa368f1390582b20332b7618ee6928a /lib | |
parent | 50b163117b6a2ca7b3325e207a16c03fd7449dad (diff) | |
download | chef-963c3d55ce11f5d00a59b216e026d1bf87e7217a.tar.gz |
add real error for bad download size
Diffstat (limited to 'lib')
-rw-r--r-- | lib/chef/exceptions.rb | 4 | ||||
-rw-r--r-- | lib/chef/http/validate_response.rb | 2 |
2 files changed, 5 insertions, 1 deletions
diff --git a/lib/chef/exceptions.rb b/lib/chef/exceptions.rb index 1c952318f1..bc4a6e3b47 100644 --- a/lib/chef/exceptions.rb +++ b/lib/chef/exceptions.rb @@ -297,5 +297,9 @@ class Chef # non-GET and non-HEAD request will thus raise an InvalidRedirect. class InvalidRedirect < StandardError; end + # Raised when the content length of a download does not match the content + # length declared in the http response. + class ContentLengthMismatch < RuntimeError; end + end end diff --git a/lib/chef/http/validate_response.rb b/lib/chef/http/validate_response.rb index 436334ab7a..1eaef3fa91 100644 --- a/lib/chef/http/validate_response.rb +++ b/lib/chef/http/validate_response.rb @@ -82,7 +82,7 @@ class Chef Chef::Log.debug "Content-Length header = #{content_length}" Chef::Log.debug "Response body length = #{response_length}" if response_length != content_length - raise "Response body length #{response_length} does not match HTTP Content-Length header #{content_length}" #FIXME: real exception + raise Chef::Exceptions::ContentLengthMismatch, "Response body length #{response_length} does not match HTTP Content-Length header #{content_length}." end true end |