aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/exceptions.rb
diff options
context:
space:
mode:
authorAdam Vandenberg2010-11-12 20:59:53 -0800
committerAdam Vandenberg2011-03-12 11:55:03 -0800
commit0225f07ebadad87d3286c65ae705e5c78e34cb20 (patch)
treeff03624cf2819b1be60b09ca85077199d7091022 /Library/Homebrew/exceptions.rb
parent719e6c8999928f45dfca2d640cd6f9a3e784e9a1 (diff)
downloadbrew-0225f07ebadad87d3286c65ae705e5c78e34cb20.tar.bz2
Move some exceptions
Diffstat (limited to 'Library/Homebrew/exceptions.rb')
-rw-r--r--Library/Homebrew/exceptions.rb24
1 files changed, 23 insertions, 1 deletions
diff --git a/Library/Homebrew/exceptions.rb b/Library/Homebrew/exceptions.rb
index 73cda01e5..66ae2b294 100644
--- a/Library/Homebrew/exceptions.rb
+++ b/Library/Homebrew/exceptions.rb
@@ -1,9 +1,30 @@
+class UsageError <RuntimeError; end
+class FormulaUnspecifiedError <UsageError; end
+class KegUnspecifiedError <UsageError; end
-class NotAKegError < RuntimeError
+class MultipleVersionsInstalledError <RuntimeError
+ attr :name
+
+ def initialize name
+ @name = name
+ super "#{name} has multiple installed versions"
+ end
+end
+
+class NotAKegError < RuntimeError; end
+
+class NoSuchKegError <RuntimeError
+ attr :name
+
+ def initialize name
+ @name = name
+ super "No such keg: #{HOMEBREW_CELLAR}/#{name}"
+ end
end
class FormulaUnavailableError < RuntimeError
attr :name
+
def initialize name
@name = name
super "No available formula for #{name}"
@@ -13,6 +34,7 @@ end
module Homebrew
class InstallationError < RuntimeError
attr :formula
+
def initialize formula
@formula = formula
end