Skip to content

Commit

Permalink
[content-service] Fix error check expression
Browse files Browse the repository at this point in the history
  • Loading branch information
aledbf authored and roboquat committed Aug 6, 2021
1 parent 90f3a7f commit eab51f4
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions components/content-service/pkg/service/workspace-service.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ package service

import (
"context"
"errors"
"strings"

"github.com/opentracing/opentracing-go"
Expand Down Expand Up @@ -51,7 +52,7 @@ func (cs *WorkspaceService) WorkspaceDownloadURL(ctx context.Context, req *api.W
WithField("blobName", blobName).
WithError(err).
Error("error getting SignDownload URL")
if err == storage.ErrNotFound {
if errors.Is(err, storage.ErrNotFound) {
return nil, status.Error(codes.NotFound, err.Error())
}
return nil, status.Error(codes.Unknown, err.Error())
Expand All @@ -77,7 +78,7 @@ func (cs *WorkspaceService) DeleteWorkspace(ctx context.Context, req *api.Delete
}
err = cs.s.DeleteObject(ctx, cs.s.Bucket(req.OwnerId), &storage.DeleteObjectQuery{Prefix: prefix})
if err != nil {
if err == storage.ErrNotFound {
if errors.Is(err, storage.ErrNotFound) {
log.WithError(err).Debug("deleting workspace backup: NotFound")
return &api.DeleteWorkspaceResponse{}, nil
}
Expand All @@ -90,7 +91,7 @@ func (cs *WorkspaceService) DeleteWorkspace(ctx context.Context, req *api.Delete
blobName := cs.s.BackupObject(req.WorkspaceId, storage.DefaultBackup)
err = cs.s.DeleteObject(ctx, cs.s.Bucket(req.OwnerId), &storage.DeleteObjectQuery{Name: blobName})
if err != nil {
if err == storage.ErrNotFound {
if errors.Is(err, storage.ErrNotFound) {
log.WithError(err).Debug("deleting workspace backup: NotFound, ", blobName)
return &api.DeleteWorkspaceResponse{}, nil
}
Expand All @@ -101,7 +102,7 @@ func (cs *WorkspaceService) DeleteWorkspace(ctx context.Context, req *api.Delete
trailPrefix := cs.s.BackupObject(req.WorkspaceId, "trail-")
err = cs.s.DeleteObject(ctx, cs.s.Bucket(req.OwnerId), &storage.DeleteObjectQuery{Prefix: trailPrefix})
if err != nil {
if err == storage.ErrNotFound {
if errors.Is(err, storage.ErrNotFound) {
log.WithError(err).Debug("deleting workspace backup: NotFound, ", trailPrefix)
return &api.DeleteWorkspaceResponse{}, nil
}
Expand Down

0 comments on commit eab51f4

Please sign in to comment.