From 2efef36313adb6ae2791ceeadfb5c7daa8bf4c50 Mon Sep 17 00:00:00 2001 From: William Woodruff Date: Tue, 9 Apr 2024 10:52:48 -0400 Subject: [PATCH] move InvalidAttestationError into Attestation mod Signed-off-by: William Woodruff --- Library/Homebrew/attestation.rb | 5 +++++ Library/Homebrew/exceptions.rb | 3 --- Library/Homebrew/formula_installer.rb | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Library/Homebrew/attestation.rb b/Library/Homebrew/attestation.rb index 0c47aff12e..ecf53d56f9 100644 --- a/Library/Homebrew/attestation.rb +++ b/Library/Homebrew/attestation.rb @@ -30,6 +30,11 @@ module Homebrew # @api private BACKFILL_CUTOFF = DateTime.new(2024, 3, 14).freeze + # Raised when attestation verification fails. + # + # @api private + class InvalidAttestationError < RuntimeError; end + # Returns a path to a suitable `gh` executable for attestation verification. # # @api private diff --git a/Library/Homebrew/exceptions.rb b/Library/Homebrew/exceptions.rb index d625491e94..1094c7e517 100644 --- a/Library/Homebrew/exceptions.rb +++ b/Library/Homebrew/exceptions.rb @@ -783,6 +783,3 @@ class CyclicDependencyError < RuntimeError EOS end end - -# Raised when attestation verification fails. -class InvalidAttestationError < RuntimeError; end diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb index 2d7985b160..4c1503033b 100644 --- a/Library/Homebrew/formula_installer.rb +++ b/Library/Homebrew/formula_installer.rb @@ -1261,7 +1261,7 @@ on_request: installed_on_request?, options:) ohai "Verifying attestation for #{formula.name}" begin Homebrew::Attestation.check_core_attestation formula.bottle - rescue InvalidAttestationError => e + rescue Homebrew::Attestation::InvalidAttestationError => e raise CannotInstallFormulaError, <<~EOS The bottle for #{formula.name} has an invalid build provenance attestation.