aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew
diff options
context:
space:
mode:
authorBaptiste Fontaine2015-10-14 14:42:34 +0200
committerBaptiste Fontaine2015-10-14 16:21:42 +0200
commitf3035333fb2963524da1668819d741ec024eb2e4 (patch)
tree79ec44caa6a7ee246d9558138a5f917e0d3d325b /Library/Homebrew
parent4cf703d5d8f7fffc86866084c6abb8003d78ed9e (diff)
downloadbrew-f3035333fb2963524da1668819d741ec024eb2e4.tar.bz2
FormulaValidationError: include full_name
Closes Homebrew/homebrew#44946. Signed-off-by: Baptiste Fontaine <batifon@yahoo.fr>
Diffstat (limited to 'Library/Homebrew')
-rw-r--r--Library/Homebrew/exceptions.rb7
-rw-r--r--Library/Homebrew/formula.rb6
2 files changed, 7 insertions, 6 deletions
diff --git a/Library/Homebrew/exceptions.rb b/Library/Homebrew/exceptions.rb
index 38bb9bf6b..957fc42b9 100644
--- a/Library/Homebrew/exceptions.rb
+++ b/Library/Homebrew/exceptions.rb
@@ -23,11 +23,12 @@ class NoSuchKegError < RuntimeError
end
class FormulaValidationError < StandardError
- attr_reader :attr
+ attr_reader :attr, :formula
- def initialize(attr, value)
+ def initialize(formula, attr, value)
@attr = attr
- super "invalid attribute: #{attr} (#{value.inspect})"
+ @formula = formula
+ super "invalid attribute for formula '#{formula}': #{attr} (#{value.inspect})"
end
end
diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb
index 9377dfe77..280213265 100644
--- a/Library/Homebrew/formula.rb
+++ b/Library/Homebrew/formula.rb
@@ -182,17 +182,17 @@ class Formula
def validate_attributes!
if name.nil? || name.empty? || name =~ /\s/
- raise FormulaValidationError.new(:name, name)
+ raise FormulaValidationError.new(full_name, :name, name)
end
url = active_spec.url
if url.nil? || url.empty? || url =~ /\s/
- raise FormulaValidationError.new(:url, url)
+ raise FormulaValidationError.new(full_name, :url, url)
end
val = version.respond_to?(:to_str) ? version.to_str : version
if val.nil? || val.empty? || val =~ /\s/
- raise FormulaValidationError.new(:version, val)
+ raise FormulaValidationError.new(full_name, :version, val)
end
end