Tweak DownloadError message to include wrapped exception

This commit is contained in:
Jack Nagel 2014-02-18 15:08:03 -05:00
parent c9784c1857
commit 9b8cff1484
2 changed files with 6 additions and 3 deletions

View File

@ -231,8 +231,11 @@ end
# Raised in Resource.fetch # Raised in Resource.fetch
class DownloadError < RuntimeError class DownloadError < RuntimeError
def initialize(formula) def initialize(resource, e)
super "Failed to download resource for package: #{formula}" super <<-EOS.undent
Failed to download resource #{resource.download_name.inspect}
#{e.message}
EOS
end end
end end

View File

@ -80,7 +80,7 @@ class Resource
HOMEBREW_CACHE.mkpath HOMEBREW_CACHE.mkpath
downloader.fetch downloader.fetch
rescue ErrorDuringExecution, CurlDownloadStrategyError => e rescue ErrorDuringExecution, CurlDownloadStrategyError => e
raise DownloadError.new(downloader.name) raise DownloadError.new(self, e)
else else
cached_download cached_download
end end