Skip to content

Commit

Permalink
Merge pull request #16129 from apainintheneck/rescue-formula-spec-err…
Browse files Browse the repository at this point in the history
…ors-in-parser

cli/parser: rescue formula specification errors
  • Loading branch information
MikeMcQuaid authored Oct 22, 2023
2 parents 46a8310 + 779d900 commit 35746e0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion Library/Homebrew/cli/named_args.rb
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,8 @@ def load_formula_or_cask(name, only: nil, method: nil, warn: nil)
warn_if_cask_conflicts(name, "formula") if only != :formula
return formula
rescue FormulaUnreadableError, FormulaClassUnavailableError,
TapFormulaUnreadableError, TapFormulaClassUnavailableError => e
TapFormulaUnreadableError, TapFormulaClassUnavailableError,
FormulaSpecificationError => e
# Need to rescue before `FormulaUnavailableError` (superclass of this)
# The formula was found, but there's a problem with its implementation
unreadable_error ||= e
Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/cli/parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,7 @@ def formulae(argv)

begin
Formulary.factory(arg, spec, flags: argv.select { |a| a.start_with?("--") })
rescue FormulaUnavailableError
rescue FormulaUnavailableError, FormulaSpecificationError
nil
end
end.compact.uniq(&:name)
Expand Down

0 comments on commit 35746e0

Please sign in to comment.