diff --git a/Library/Homebrew/software_spec.rb b/Library/Homebrew/software_spec.rb index 0720fab3da16dc6fe3712e9cab69d1105116e77c..6477dfd560c7fae0a871338bc9a0161fe1863e52 100644 --- a/Library/Homebrew/software_spec.rb +++ b/Library/Homebrew/software_spec.rb @@ -122,9 +122,12 @@ class SoftwareSpec puts "Symbols are reserved for future use, please pass a string instead" name = name.to_s end + unless String === name + raise ArgumentError, "option name must be string or symbol; got a #{name.class}: #{name}" + end raise ArgumentError, "option name is required" if name.empty? - raise ArgumentError, "option name must be longer than one character" unless name.length > 1 - raise ArgumentError, "option name must not start with dashes" if name.start_with?("-") + raise ArgumentError, "option name must be longer than one character: #{name}" unless name.length > 1 + raise ArgumentError, "option name must not start with dashes: #{name}" if name.start_with?("-") Option.new(name, description) end options << opt