diff options
author | Lars Wirzenius <liw@liw.fi> | 2021-11-27 09:57:54 +0200 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2021-11-27 11:21:16 +0200 |
commit | 9dcd23354ec74daf4000ec40bd52a33341a16cd8 (patch) | |
tree | 7a88381b98637fa723f699feb6ad40a2725b1ace /src/backup_run.rs | |
parent | 8d00d6e452638cbb5418887d0057b95d777a8fa0 (diff) | |
download | obnam2-9dcd23354ec74daf4000ec40bd52a33341a16cd8.tar.gz |
feat! turn errors from backup root directory into errors
Previously an error from, say, a missing backup root directory was
reported to the user as a warning. Turn it into an error. However,
errors reading a file or directory inside the backup root should still
be just a warning.
Sponsored-by: author
Diffstat (limited to 'src/backup_run.rs')
-rw-r--r-- | src/backup_run.rs | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/backup_run.rs b/src/backup_run.rs index fb823be..0853bdf 100644 --- a/src/backup_run.rs +++ b/src/backup_run.rs @@ -164,9 +164,8 @@ impl<'a> BackupRun<'a> { } } Err(err) => { - debug!("ignoring backup error {}", err); - warnings.push(err.into()); self.found_problem(); + return Err(err.into()); } } } @@ -193,9 +192,16 @@ impl<'a> BackupRun<'a> { let mut warnings: Vec<BackupError> = vec![]; let mut new_cachedir_tags = vec![]; let iter = FsIterator::new(root, config.exclude_cache_tag_directories); + let mut first_entry = true; for entry in iter { match entry { Err(err) => { + if first_entry { + // Only the first entry (the backup root) + // failing is an error. Everything else is a + // warning. + return Err(NascentError::BackupRootFailed(root.to_path_buf(), err)); + } warnings.push(err.into()); } Ok(entry) => { @@ -217,6 +223,7 @@ impl<'a> BackupRun<'a> { } } } + first_entry = false; } Ok(OneRootBackupOutcome { |