lib/model: Improve errors when deleting dirs (fixes #6575) (#6586)

This commit is contained in:
Simon Frei 2020-05-01 11:11:38 +02:00 committed by GitHub
parent bd0c2bf237
commit 2e3975e956
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -64,9 +64,10 @@ const retainBits = fs.ModeSetgid | fs.ModeSetuid | fs.ModeSticky
var ( var (
activity = newDeviceActivity() activity = newDeviceActivity()
errNoDevice = errors.New("peers who had this file went away, or the file has changed while syncing. will retry later") errNoDevice = errors.New("peers who had this file went away, or the file has changed while syncing. will retry later")
errDirHasToBeScanned = errors.New("directory contains unexpected files, scheduling scan") errDirPrefix = "directory has been deleted on a remote device but "
errDirHasIgnored = errors.New("directory contains ignored files (see ignore documentation for (?d) prefix)") errDirHasToBeScanned = errors.New(errDirPrefix + "contains unexpected files, scheduling scan")
errDirNotEmpty = errors.New("directory is not empty; files within are probably ignored on connected devices only") errDirHasIgnored = errors.New(errDirPrefix + "contains ignored files (see ignore documentation for (?d) prefix)")
errDirNotEmpty = errors.New(errDirPrefix + "is not empty; the contents are probably ignored on that remote device, but not locally")
errNotAvailable = errors.New("no connected device has the required version of this file") errNotAvailable = errors.New("no connected device has the required version of this file")
errModified = errors.New("file modified but not rescanned; will try again later") errModified = errors.New("file modified but not rescanned; will try again later")
errUnexpectedDirOnFileDel = errors.New("encountered directory when trying to remove file/symlink") errUnexpectedDirOnFileDel = errors.New("encountered directory when trying to remove file/symlink")
@ -783,7 +784,7 @@ func (f *sendReceiveFolder) deleteDir(file protocol.FileInfo, snap *db.Snapshot,
}() }()
if err = f.deleteDirOnDisk(file.Name, snap, scanChan); err != nil { if err = f.deleteDirOnDisk(file.Name, snap, scanChan); err != nil {
f.newPullError(file.Name, errors.Wrap(err, "delete dir")) f.newPullError(file.Name, err)
return return
} }