Skip to content

Commit

Permalink
[content-service] Only log gcp error if is not related to ErrBucketNo…
Browse files Browse the repository at this point in the history
…tExist
  • Loading branch information
aledbf authored and roboquat committed Jul 26, 2021
1 parent 89db73e commit c1eade3
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion components/content-service/pkg/storage/gcloud.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ package storage
import (
"context"
"encoding/hex"
"errors"
"fmt"
"hash/crc32"
"io"
Expand Down Expand Up @@ -937,7 +938,10 @@ func (p *PresignedGCPStorage) DeleteObject(ctx context.Context, bucket string, q
if query.Name != "" {
err = client.Bucket(bucket).Object(query.Name).Delete(ctx)
if err != nil {
log.WithField("bucket", bucket).WithField("object", query.Name).WithError(err).Error("cannot delete objects")
if !errors.Is(err, gcpstorage.ErrBucketNotExist) {
log.WithField("bucket", bucket).WithField("object", query.Name).WithError(err).Error("cannot delete objects")
}

if err == gcpstorage.ErrBucketNotExist || err == gcpstorage.ErrObjectNotExist {
return ErrNotFound
}
Expand Down

0 comments on commit c1eade3

Please sign in to comment.