Skip to content

Commit 6543848

Browse files
fix: if backup happy path fails, cancel the sync
1 parent a22ed06 commit 6543848

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

sync/flow.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -534,9 +534,11 @@ func download(client *romm.Client, config *internal.Config, deviceID string, ite
534534
backupPath := filepath.Join(backupDir, fmt.Sprintf("%s [%s]%s", base, timestamp, ext))
535535

536536
if err := os.MkdirAll(backupDir, 0755); err != nil {
537-
logger.Warn("Failed to create backup directory", "path", backupDir, "error", err)
537+
logger.Error("Failed to create backup directory, aborting download", "path", backupDir, "error", err)
538+
return false
538539
} else if err := fileutil.CopyFile(item.LocalSave.FilePath, backupPath); err != nil {
539-
logger.Warn("Failed to backup save before download", "path", item.LocalSave.FilePath, "error", err)
540+
logger.Error("Failed to backup save before download, aborting download", "path", item.LocalSave.FilePath, "error", err)
541+
return false
540542
} else {
541543
logger.Debug("Backed up save before download", "backup", backupPath)
542544
if config != nil && config.SaveBackupLimit > 0 {

0 commit comments

Comments
 (0)