Commit 44543853 authored by acud's avatar acud Committed by GitHub

shed: return swallowed error (#1426)

parent b66088cf
...@@ -106,12 +106,14 @@ func (db *DB) Put(key, value []byte) (err error) { ...@@ -106,12 +106,14 @@ func (db *DB) Put(key, value []byte) (err error) {
// Get wraps LevelDB Get method to increment metrics counter. // Get wraps LevelDB Get method to increment metrics counter.
func (db *DB) Get(key []byte) (value []byte, err error) { func (db *DB) Get(key []byte) (value []byte, err error) {
value, err = db.ldb.Get(key, nil) value, err = db.ldb.Get(key, nil)
if err != nil {
if errors.Is(err, leveldb.ErrNotFound) { if errors.Is(err, leveldb.ErrNotFound) {
db.metrics.GetNotFoundCounter.Inc() db.metrics.GetNotFoundCounter.Inc()
return nil, err
} else { } else {
db.metrics.GetFailCounter.Inc() db.metrics.GetFailCounter.Inc()
} }
return nil, err
}
db.metrics.GetCounter.Inc() db.metrics.GetCounter.Inc()
return value, nil return value, nil
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment