Skip to content

Commit

Permalink
fix(correctedmemstore): pass CID to ErrNotFound
Browse files Browse the repository at this point in the history
  • Loading branch information
rvagg committed Oct 3, 2023
1 parent e92f567 commit a9406e4
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions testutil/correctedmemstore.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ func (cms *CorrectedMemStore) Get(ctx context.Context, key string) ([]byte, erro
} else if err != nil {
return nil, err
}

data, err := cms.ParentStore.Get(ctx, key)
if err != nil && err.Error() == "404" {
err = format.ErrNotFound{}
cid, _ := cid.Cast([]byte(key))
err = format.ErrNotFound{Cid: cid}
}
return data, err
}
Expand All @@ -58,7 +58,8 @@ func (cms *CorrectedMemStore) GetStream(ctx context.Context, key string) (io.Rea
}
rc, err := cms.ParentStore.GetStream(ctx, key)
if err != nil && err.Error() == "404" {
err = format.ErrNotFound{}
cid, _ := cid.Cast([]byte(key))
err = format.ErrNotFound{Cid: cid}
}
return rc, err
}

0 comments on commit a9406e4

Please sign in to comment.