aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/exceptions.rb
diff options
context:
space:
mode:
authorAlyssa Ross2017-02-01 18:30:55 +0000
committerAlyssa Ross2017-02-01 18:34:20 +0000
commitade8128a18ec3a053306e364e31687739de8c568 (patch)
tree1dc84a22cf4510a5df941d775a9b6e98ddc9a2d2 /Library/Homebrew/exceptions.rb
parentb6f3399cb3facababf4f6b1e6f7821edc2db554a (diff)
downloadbrew-ade8128a18ec3a053306e364e31687739de8c568.tar.bz2
formulary: handle ScriptError in formula
I added a new `FormulaUnreadableError` subclass of `FormulaUnavailableError` so existing `rescue`s of `FormulaUnavailableError` handle this as well. The new subclass will output the name of the formula with the error (because this isn't always obvious from the original exception message) followed by the original error message. Fixes #1927.
Diffstat (limited to 'Library/Homebrew/exceptions.rb')
-rw-r--r--Library/Homebrew/exceptions.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/Library/Homebrew/exceptions.rb b/Library/Homebrew/exceptions.rb
index c5d888d64..77da4489e 100644
--- a/Library/Homebrew/exceptions.rb
+++ b/Library/Homebrew/exceptions.rb
@@ -131,6 +131,19 @@ class FormulaClassUnavailableError < FormulaUnavailableError
end
end
+class FormulaUnreadableError < FormulaUnavailableError
+ attr_reader :formula_error
+
+ def initialize(name, error)
+ super(name)
+ @formula_error = error
+ end
+
+ def to_s
+ "#{name}: " + formula_error.to_s
+ end
+end
+
class TapFormulaAmbiguityError < RuntimeError
attr_reader :name, :paths, :formulae