forked from Silverfish/proton-bridge
feat(GODT-2674): Add more logs during update failed.
This commit is contained in:
@ -35,11 +35,13 @@ func syncFolders(localPath, updatePath string) (err error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if err = removeMissing(localPath, updatePath); err != nil {
|
if err = removeMissing(localPath, updatePath); err != nil {
|
||||||
|
logrus.WithError(err).Error("Sync folders: failed to remove missing.")
|
||||||
restoreFromBackup(backupDir, localPath)
|
restoreFromBackup(backupDir, localPath)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if err = copyRecursively(updatePath, localPath); err != nil {
|
if err = copyRecursively(updatePath, localPath); err != nil {
|
||||||
|
logrus.WithError(err).Error("Sync folders: failed to copy.")
|
||||||
restoreFromBackup(backupDir, localPath)
|
restoreFromBackup(backupDir, localPath)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -89,8 +91,8 @@ func removeMissing(folderToCleanPath, itemsToKeepPath string) (err error) {
|
|||||||
|
|
||||||
for _, removeThis := range delList {
|
for _, removeThis := range delList {
|
||||||
if err = os.RemoveAll(removeThis); err != nil && !errors.Is(err, fs.ErrNotExist) {
|
if err = os.RemoveAll(removeThis); err != nil && !errors.Is(err, fs.ErrNotExist) {
|
||||||
logrus.Error("remove error ", err)
|
logrus.WithField("path", removeThis).WithError(err).Error("Remove error.")
|
||||||
return
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user