diff options
| author | Xu Cheng | 2015-06-13 14:32:10 +0800 |
|---|---|---|
| committer | Xu Cheng | 2015-06-14 21:28:36 +0800 |
| commit | b88cb13718357c26a10fa1ac68d630225c7791fb (patch) | |
| tree | 86b90332aa7ec137d523ab6bc2b9704d7f1da1fe /Library | |
| parent | 696d7f3ba0c38f4dff8e7361ea1199a77ddb881a (diff) | |
| download | brew-b88cb13718357c26a10fa1ac68d630225c7791fb.tar.bz2 | |
add TapUnavailableError
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/cmd/readall.rb | 2 | ||||
| -rw-r--r-- | Library/Homebrew/cmd/untap.rb | 2 | ||||
| -rw-r--r-- | Library/Homebrew/exceptions.rb | 12 |
3 files changed, 14 insertions, 2 deletions
diff --git a/Library/Homebrew/cmd/readall.rb b/Library/Homebrew/cmd/readall.rb index 9216f6377..260a1750d 100644 --- a/Library/Homebrew/cmd/readall.rb +++ b/Library/Homebrew/cmd/readall.rb @@ -35,7 +35,7 @@ module Homebrew formulae = Formula.full_names else tap = Tap.new(*tap_args) - raise "#{tap} does not exist!" unless tap.installed? + raise TapUnavailableError, tap.name unless tap.installed? formulae = tap.formula_files end diff --git a/Library/Homebrew/cmd/untap.rb b/Library/Homebrew/cmd/untap.rb index dd66cec1b..f1040bb05 100644 --- a/Library/Homebrew/cmd/untap.rb +++ b/Library/Homebrew/cmd/untap.rb @@ -7,7 +7,7 @@ module Homebrew ARGV.named.each do |tapname| tap = Tap.new(*tap_args(tapname)) - raise "No such tap!" unless tap.installed? + raise TapUnavailableError, tap.name unless tap.installed? puts "Untapping #{tap}... (#{tap.path.abv})" formula_count = tap.formula_files.size diff --git a/Library/Homebrew/exceptions.rb b/Library/Homebrew/exceptions.rb index 7ae185d00..7eb053a7c 100644 --- a/Library/Homebrew/exceptions.rb +++ b/Library/Homebrew/exceptions.rb @@ -84,6 +84,18 @@ class TapFormulaAmbiguityError < RuntimeError end end +class TapUnavailableError < RuntimeError + attr_reader :name + + def initialize name + @name = name + + super <<-EOS.undent + No available tap #{name}. + EOS + end +end + class OperationInProgressError < RuntimeError def initialize name message = <<-EOS.undent |
