diff options
| author | Charlie Sharpsteen | 2011-09-14 12:18:35 -0700 |
|---|---|---|
| committer | Charlie Sharpsteen | 2011-09-19 09:21:36 -0700 |
| commit | ff7c88655698b8211c3cc45c16ef05ce924dea91 (patch) | |
| tree | 44b78c26a27cc98c33bfb3cb4bbcbed07da20594 /Library/Homebrew/exceptions.rb | |
| parent | 560fb2dbcb118e9849ffb823f61345e2f9f465ef (diff) | |
| download | brew-ff7c88655698b8211c3cc45c16ef05ce924dea91.tar.bz2 | |
exceptions.rb: Add DownloadError
`DownloadError` is an exception that download stratigies can throw to indicate
that a fetch was incomplete due to a failure in communication.
The `curl` method in `utils.rb` has been upgraded to throw a `DownloadError` if
something bad happens to `curl` execution.
Diffstat (limited to 'Library/Homebrew/exceptions.rb')
| -rw-r--r-- | Library/Homebrew/exceptions.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/Library/Homebrew/exceptions.rb b/Library/Homebrew/exceptions.rb index 72c62dcc7..e77c0573a 100644 --- a/Library/Homebrew/exceptions.rb +++ b/Library/Homebrew/exceptions.rb @@ -112,3 +112,17 @@ class BuildError < Homebrew::InstallationError @command == './configure' end end + +class DownloadError < RuntimeError + attr :command + attr :args + attr :exit_status + + def initialize cmd, args, status + @command = cmd + @args = args + args.map!{ |arg| arg.to_s.gsub " ", "\\ " } + super "#{cmd} #{args.join ' '}\nDownloader failed with exit status #{status}" + @exit_status = status + end +end |
