Merge pull request #8996 from cli/wm/improve-verify-error-messages
Improve errors when loading bundle locally fails
This commit is contained in:
commit
fc2aec380d
2 changed files with 3 additions and 3 deletions
|
|
@ -13,7 +13,7 @@ import (
|
|||
"github.com/sigstore/sigstore-go/pkg/bundle"
|
||||
)
|
||||
|
||||
var ErrLocalAttestations = errors.New("failed to load local attestations")
|
||||
var ErrUnrecognisedBundleExtension = errors.New("bundle file extension not supported, must be json or jsonl")
|
||||
|
||||
type FetchAttestationsConfig struct {
|
||||
APIClient api.Client
|
||||
|
|
@ -52,7 +52,7 @@ func GetLocalAttestations(path string) ([]*api.Attestation, error) {
|
|||
}
|
||||
return attestations, nil
|
||||
}
|
||||
return nil, ErrLocalAttestations
|
||||
return nil, ErrUnrecognisedBundleExtension
|
||||
}
|
||||
|
||||
func loadBundleFromJSONFile(path string) ([]*api.Attestation, error) {
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ func TestGetLocalAttestations(t *testing.T) {
|
|||
path := "../test/data/sigstore-js-2.1.0-bundles.tgz"
|
||||
attestations, err := GetLocalAttestations(path)
|
||||
|
||||
require.ErrorIs(t, err, ErrLocalAttestations)
|
||||
require.ErrorIs(t, err, ErrUnrecognisedBundleExtension)
|
||||
require.Nil(t, attestations)
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue