lib: Return error from db.FileSet.Snapshot (fixes #7419, ref #5907) (#7424)

This commit is contained in:
Simon Frei
2021-03-07 13:43:22 +01:00
committed by GitHub
parent c1d06d9501
commit 310fba4c12
25 changed files with 601 additions and 344 deletions
+4 -3
View File
@@ -151,12 +151,13 @@ type Snapshot struct {
fatalError func(error, string)
}
func (s *FileSet) Snapshot() *Snapshot {
func (s *FileSet) Snapshot() (*Snapshot, error) {
opStr := fmt.Sprintf("%s Snapshot()", s.folder)
l.Debugf(opStr)
t, err := s.db.newReadOnlyTransaction()
if err != nil {
fatalError(err, opStr, s.db)
s.db.handleFailure(err)
return nil, err
}
return &Snapshot{
folder: s.folder,
@@ -165,7 +166,7 @@ func (s *FileSet) Snapshot() *Snapshot {
fatalError: func(err error, opStr string) {
fatalError(err, opStr, s.db)
},
}
}, nil
}
func (s *Snapshot) Release() {