From 406253a90b48d1f7a810ec05e126131c22185d5d Mon Sep 17 00:00:00 2001 From: Tulsi Shah Date: Fri, 27 Dec 2024 07:27:47 +0000 Subject: [PATCH] review comment --- internal/storage/bucket_handle.go | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/internal/storage/bucket_handle.go b/internal/storage/bucket_handle.go index 6d2b345058..a8328be2c5 100644 --- a/internal/storage/bucket_handle.go +++ b/internal/storage/bucket_handle.go @@ -593,18 +593,14 @@ func (bh *bucketHandle) MoveObject(ctx context.Context, req *gcs.MoveObjectReque // If storage object does not exist, httpclient is returning ErrObjectNotExist error instead of googleapi error // https://github.com/GoogleCloudPlatform/gcsfuse/blob/master/vendor/cloud.google.com/go/storage/http_client.go#L516 - if err != nil { - if ok, preCondErr := isPreconditionFailed(err); ok { - err = preCondErr - } else if errors.Is(err, storage.ErrObjectNotExist) { - err = &gcs.NotFoundError{Err: storage.ErrObjectNotExist} - } else { - err = fmt.Errorf("error in moving object: %w", err) - } - return nil, err + if ok, preCondErr := isPreconditionFailed(err); ok { + err = preCondErr + } else if errors.Is(err, storage.ErrObjectNotExist) { + err = &gcs.NotFoundError{Err: storage.ErrObjectNotExist} + } else { + err = fmt.Errorf("error in moving object: %w", err) } - - return o, nil + return nil, err } func (bh *bucketHandle) RenameFolder(ctx context.Context, folderName string, destinationFolderId string) (folder *gcs.Folder, err error) {