summaryrefslogtreecommitdiff
path: root/lib/rubygems/remote_fetcher.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rubygems/remote_fetcher.rb')
-rw-r--r--lib/rubygems/remote_fetcher.rb10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/rubygems/remote_fetcher.rb b/lib/rubygems/remote_fetcher.rb
index eac4ccaf01..cb22e1f1b1 100644
--- a/lib/rubygems/remote_fetcher.rb
+++ b/lib/rubygems/remote_fetcher.rb
@@ -16,7 +16,7 @@ class Gem::RemoteFetcher
# Cached RemoteFetcher instance.
def self.fetcher
- @fetcher ||= new Gem.configuration[:http_proxy]
+ @fetcher ||= self.new Gem.configuration[:http_proxy]
end
# Initialize a remote fetcher using the source URI and possible proxy
@@ -45,8 +45,12 @@ class Gem::RemoteFetcher
end
rescue Timeout::Error
raise FetchError, "timed out fetching #{uri}"
- rescue OpenURI::HTTPError, IOError, SocketError, SystemCallError => e
+ rescue IOError, SocketError, SystemCallError => e
raise FetchError, "#{e.class}: #{e} reading #{uri}"
+ rescue OpenURI::HTTPError => e
+ body = e.io.readlines.join "\n\t"
+ message = "#{e.class}: #{e} reading #{uri}\n\t#{body}"
+ raise FetchError, message
end
# Returns the size of +uri+ in bytes.
@@ -79,7 +83,7 @@ class Gem::RemoteFetcher
end
rescue SocketError, SystemCallError, Timeout::Error => e
- raise FetchError, "#{e.message} (#{e.class})"
+ raise FetchError, "#{e.message} (#{e.class})\n\tgetting size of #{uri}"
end
private