Skip to content

Commit

Permalink
refactor: follow the happy left practice in Filestore.DeleteBlock
Browse files Browse the repository at this point in the history
This commit was moved from ipfs/go-filestore@f280748
  • Loading branch information
Jorropo committed Mar 17, 2022
1 parent 049d13b commit 3f1d60e
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions filestore/filestore.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,18 +123,18 @@ func (f *Filestore) DeleteBlock(ctx context.Context, c cid.Cid) error {
}

err2 := f.fm.DeleteBlock(ctx, c)

// if we successfully removed something from the blockstore, but the
// filestore didnt have it, return success
if !ipld.IsNotFound(err2) {
return err2
}

if ipld.IsNotFound(err2) {
if ipld.IsNotFound(err1) {
return err1
}
// being here means err1 was nil and err2 NotFound.
return nil
if ipld.IsNotFound(err1) {
return err1
}

return err2
return nil
}

// Get retrieves the block with the given Cid. It may return
Expand Down

0 comments on commit 3f1d60e

Please sign in to comment.