aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/os
diff options
context:
space:
mode:
authorJack Nagel2014-07-16 21:11:48 -0500
committerJack Nagel2014-07-16 21:11:48 -0500
commit596f3ba0a00b90d6a47ef5860b371f08fc8a72bd (patch)
treeaf5cadf4da79fcf247d947bd7197556877f13832 /Library/Homebrew/os
parenta554b5c9b74bd94470ddd812295efc6ec44fbdde (diff)
downloadbrew-596f3ba0a00b90d6a47ef5860b371f08fc8a72bd.tar.bz2
Raise ArgumentError when a symbol can't be mapped to a version
The fact that this is implemented as a hash lookup is an implementation detail, so don't let the KeyError bubble up.
Diffstat (limited to 'Library/Homebrew/os')
-rw-r--r--Library/Homebrew/os/mac/version.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/Library/Homebrew/os/mac/version.rb b/Library/Homebrew/os/mac/version.rb
index ed05ac553..06901b642 100644
--- a/Library/Homebrew/os/mac/version.rb
+++ b/Library/Homebrew/os/mac/version.rb
@@ -14,7 +14,10 @@ module OS
}
def self.from_symbol(sym)
- new(SYMBOLS.fetch(sym))
+ str = SYMBOLS.fetch(sym) do
+ raise ArgumentError, "unknown version #{sym.inspect}"
+ end
+ new(str)
end
def initialize(*args)