Skip to content

Commit fbef078

Browse files
committed
Fix error handling for missing keys in stores
1 parent 1e89b62 commit fbef078

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

store/bolt_store_test.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,8 @@ func TestBoltStore(t *testing.T) {
3434
assert.Equal(t, []byte("bar"), res)
3535
assert.NoError(t, st.Delete(ctx, key))
3636
// bolt store does not support NotFound
37-
res, err = st.Get(ctx, []byte("aaaaaa"))
38-
assert.NoError(t, err)
39-
assert.Nil(t, res)
37+
_, err = st.Get(ctx, []byte("aaaaaa"))
38+
assert.Equal(t, err, ErrKeyNotFound)
4039
}
4140
}
4241

store/rb_memory_store.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ func (s *rbMemoryStore) Get(ctx context.Context, key []byte) ([]byte, error) {
8585

8686
vv, ok := v.([]byte)
8787
if !ok {
88-
return nil, errors.WithStack(ErrKeyNotFound)
88+
return nil, ErrKeyNotFound
8989
}
9090

9191
return vv, nil

0 commit comments

Comments
 (0)