Merge pull request #16129 from apainintheneck/rescue-formula-spec-errors-in-parser

cli/parser: rescue formula specification errors
This commit is contained in:
Mike McQuaid 2023-10-22 10:34:28 +01:00 committed by GitHub
commit 35746e0a6b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View File

@ -140,7 +140,8 @@ module Homebrew
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

View File

@ -653,7 +653,7 @@ module Homebrew
begin
Formulary.factory(arg, spec, flags: argv.select { |a| a.start_with?("--") })
rescue FormulaUnavailableError
rescue FormulaUnavailableError, FormulaSpecificationError
nil
end
end.compact.uniq(&:name)