From 877dd111330e9f147370fd4a4f8201a2e262ce2a Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Tue, 2 Jul 2019 08:56:56 +0200 Subject: [PATCH] src/backup/{fixed, dynamic}_index.rs: improve error messages --- src/backup/dynamic_index.rs | 3 ++- src/backup/fixed_index.rs | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/backup/dynamic_index.rs b/src/backup/dynamic_index.rs index 4374d37b..30e4e202 100644 --- a/src/backup/dynamic_index.rs +++ b/src/backup/dynamic_index.rs @@ -61,7 +61,8 @@ impl DynamicIndexReader { pub fn open(path: &Path) -> Result { - let file = std::fs::File::open(&path)?; + let file = std::fs::File::open(&path) + .map_err(|err| format_err!("Unable to open dynamic index {:?} - {}", path, err))?; if let Err(err) = nix::fcntl::flock(file.as_raw_fd(), nix::fcntl::FlockArg::LockSharedNonblock) { bail!("unable to get shared lock on {:?} - {}", path, err); diff --git a/src/backup/fixed_index.rs b/src/backup/fixed_index.rs index 086efd56..a4d6213e 100644 --- a/src/backup/fixed_index.rs +++ b/src/backup/fixed_index.rs @@ -60,7 +60,8 @@ impl FixedIndexReader { let full_path = store.relative_path(path); - let mut file = File::open(&full_path)?; + let mut file = File::open(&full_path) + .map_err(|err| format_err!("Unable to open fixed index {:?} - {}", full_path, err))?; if let Err(err) = nix::fcntl::flock(file.as_raw_fd(), nix::fcntl::FlockArg::LockSharedNonblock) { bail!("unable to get shared lock on {:?} - {}", full_path, err);