Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions internal/blobmanager/azureblob/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,7 @@ func resourceName(digest string) string {
// Exists check that the artifact is already present in the repository
func (b *Backend) Exists(ctx context.Context, digest string) (bool, error) {
_, err := b.Describe(ctx, digest)
notFoundErr := &backend.ErrNotFound{}
if err != nil && errors.As(err, &notFoundErr) {
if err != nil && backend.IsNotFound(err) {
return false, nil
}

Expand Down
5 changes: 2 additions & 3 deletions internal/blobmanager/s3/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,7 @@ func NewBackend(creds *Credentials, connOpts ...ConnOpt) (*Backend, error) {
// Exists check that the artifact is already present in the repository
func (b *Backend) Exists(ctx context.Context, digest string) (bool, error) {
_, err := b.Describe(ctx, digest)
notFoundErr := &backend.ErrNotFound{}
if err != nil && errors.As(err, &notFoundErr) {
if err != nil && backend.IsNotFound(err) {
return false, nil
}

Expand Down Expand Up @@ -129,7 +128,7 @@ func (b *Backend) Describe(ctx context.Context, digest string) (*pb.CASResource,
var awsErr awserr.Error
if err != nil {
if errors.As(err, &awsErr) && awsErr.Code() == "NotFound" {
return nil, &backend.ErrNotFound{}
return nil, backend.NewErrNotFound("artifact")
}

return nil, fmt.Errorf("failed to read from bucket: %w", err)
Expand Down
3 changes: 1 addition & 2 deletions internal/blobmanager/s3/backend_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,7 @@ func (s *testSuite) TestDescribe() {
s.T().Run("doesn't exist", func(t *testing.T) {
artifact, err := s.backend.Describe(context.Background(), "aabbccddeeff")
s.Error(err)
notFoundErr := &backend.ErrNotFound{}
s.ErrorAs(err, &notFoundErr)
s.True(backend.IsNotFound(err))
s.Nil(artifact)
})

Expand Down