diff options
| author | Alyssa Ross | 2017-02-01 18:30:55 +0000 | 
|---|---|---|
| committer | Alyssa Ross | 2017-02-01 18:34:20 +0000 | 
| commit | ade8128a18ec3a053306e364e31687739de8c568 (patch) | |
| tree | 1dc84a22cf4510a5df941d775a9b6e98ddc9a2d2 /Library/Homebrew/formulary.rb | |
| parent | b6f3399cb3facababf4f6b1e6f7821edc2db554a (diff) | |
| download | brew-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/formulary.rb')
| -rw-r--r-- | Library/Homebrew/formulary.rb | 6 | 
1 files changed, 5 insertions, 1 deletions
diff --git a/Library/Homebrew/formulary.rb b/Library/Homebrew/formulary.rb index 25df57cdc..cf85ba03f 100644 --- a/Library/Homebrew/formulary.rb +++ b/Library/Homebrew/formulary.rb @@ -22,7 +22,11 @@ class Formulary      mod = Module.new      const_set(namespace, mod) -    mod.module_eval(contents, path) +    begin +      mod.module_eval(contents, path) +    rescue ScriptError => e +      raise FormulaUnreadableError.new(name, e) +    end      class_name = class_s(name)      begin  | 
