fsrepo: check dsErr before returning datastore

This commit is contained in:
Łukasz Magiera 2019-07-11 13:48:21 +02:00
parent 1f97ad2c2e
commit ffafc056ee

View File

@ -148,7 +148,10 @@ func (fsr *fsLockedRepo) Datastore(ns string) (datastore.Batching, error) {
fsr.dsOnce.Do(func() {
fsr.ds, fsr.dsErr = badger.NewDatastore(fsr.join(fsDatastore), nil)
})
return namespace.Wrap(fsr.ds, datastore.NewKey(ns)), fsr.dsErr
if fsr.dsErr != nil {
return nil, fsr.dsErr
}
return namespace.Wrap(fsr.ds, datastore.NewKey(ns)), nil
}
func (fsr *fsLockedRepo) Config() (*config.Root, error) {