diff --git a/pkg/core/storage/leveldb_store.go b/pkg/core/storage/leveldb_store.go index 1bc6e013b..f024c41d3 100644 --- a/pkg/core/storage/leveldb_store.go +++ b/pkg/core/storage/leveldb_store.go @@ -41,7 +41,11 @@ func (s *LevelDBStore) Put(key, value []byte) error { // Get implements the Store interface. func (s *LevelDBStore) Get(key []byte) ([]byte, error) { - return s.db.Get(key, nil) + value, err := s.db.Get(key, nil) + if err == leveldb.ErrNotFound { + err = ErrKeyNotFound + } + return value, err } // PutBatch implements the Store interface. diff --git a/pkg/core/storage/redis_store.go b/pkg/core/storage/redis_store.go index 069581956..5dd5ac4e0 100644 --- a/pkg/core/storage/redis_store.go +++ b/pkg/core/storage/redis_store.go @@ -40,6 +40,9 @@ func (s *RedisStore) Batch() Batch { func (s *RedisStore) Get(k []byte) ([]byte, error) { val, err := s.client.Get(string(k)).Result() if err != nil { + if err == redis.Nil { + err = ErrKeyNotFound + } return nil, err } return []byte(val), nil