Skip to content

Commit

Permalink
Update wrapped error while returning FileClobberedError after calling…
Browse files Browse the repository at this point in the history
… clobbered method (#2885)

* Update wrapped error in FileClobberedError

* handled nil error explicitly

* executing checking err for not nil before clobbered check

* refactored code according to go style guide

* minor fix

* fixed formatting
  • Loading branch information
vipnydav authored Jan 10, 2025
1 parent 70735ea commit 6015cdb
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions internal/fs/inode/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -726,13 +726,15 @@ func (f *FileInode) fetchLatestGcsObject(ctx context.Context) (*gcs.Object, erro
// default sets the projection to full, which fetches all the object
// properties.
latestGcsObj, isClobbered, err := f.clobbered(ctx, true, true)
if err != nil {
return nil, err
}
if isClobbered {
err = &gcsfuse_errors.FileClobberedError{
Err: err,
return nil, &gcsfuse_errors.FileClobberedError{
Err: fmt.Errorf("file was clobbered"),
}
}

return latestGcsObj, err
return latestGcsObj, nil
}

// Sync writes out contents to GCS. If this fails due to the generation
Expand Down

0 comments on commit 6015cdb

Please sign in to comment.