Restore fails fast on first error; --skip-errors is now global
restore aborts on the first per-file failure by default, surfacing the file path and the underlying error and suggesting --skip-errors to continue past failures. --skip-errors moved from a 'snapshot create' subcommand flag to a top-level persistent flag on the root command. It applies to both snapshot create and restore. Old 'vaultik snapshot create --skip- errors' still works because persistent flags are inherited.
This commit is contained in:
@@ -35,6 +35,7 @@ type RestoreOptions struct {
|
||||
TargetDir string
|
||||
Paths []string // Optional paths to restore (empty = all)
|
||||
Verify bool // Verify restored files by checking chunk hashes
|
||||
SkipErrors bool // Continue past file-restore errors instead of aborting
|
||||
}
|
||||
|
||||
// RestoreResult contains statistics from a restore operation
|
||||
@@ -195,6 +196,10 @@ func (v *Vaultik) restoreAllFiles(
|
||||
|
||||
if err := v.restoreFile(v.ctx, repos, file, opts.TargetDir, identity, chunkToBlobMap, blobCache, result); err != nil {
|
||||
log.Error("Failed to restore file", "path", file.Path, "error", err)
|
||||
if !opts.SkipErrors {
|
||||
return nil, fmt.Errorf("restoring %s: %w (pass --skip-errors to continue past restore failures)", file.Path, err)
|
||||
}
|
||||
v.UI.Error("Failed to restore %s: %v. Skipping (--skip-errors).", v.UI.Path(file.Path.String()), err)
|
||||
result.FilesFailed++
|
||||
result.FailedFiles = append(result.FailedFiles, file.Path.String())
|
||||
// Update progress bar even on failure
|
||||
|
||||
Reference in New Issue
Block a user