libnetwork/internal/kvstore/boltdb: BoltDB.Exists(): fix error handling
This function could potentially return "true" even if an error was returned. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
c94ccd4207
commit
fb61b07bcf
1 changed files with 7 additions and 2 deletions
|
@ -220,8 +220,13 @@ func (b *BoltDB) Exists(key string) (bool, error) {
|
|||
exists = len(bucket.Get([]byte(key))) > 0
|
||||
return nil
|
||||
})
|
||||
|
||||
return exists, err
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
if !exists {
|
||||
return false, store.ErrKeyNotFound
|
||||
}
|
||||
return true, nil
|
||||
}
|
||||
|
||||
// List returns the range of keys starting with the passed in prefix
|
||||
|
|
Loading…
Add table
Reference in a new issue