src/backup/{fixed, dynamic}_index.rs: improve error messages
This commit is contained in:
		@ -61,7 +61,8 @@ impl DynamicIndexReader {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    pub fn open(path: &Path) -> Result<Self, Error> {
 | 
					    pub fn open(path: &Path) -> Result<Self, Error> {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        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) {
 | 
					        if let Err(err) = nix::fcntl::flock(file.as_raw_fd(), nix::fcntl::FlockArg::LockSharedNonblock) {
 | 
				
			||||||
            bail!("unable to get shared lock on {:?} - {}", path, err);
 | 
					            bail!("unable to get shared lock on {:?} - {}", path, err);
 | 
				
			||||||
 | 
				
			|||||||
@ -60,7 +60,8 @@ impl FixedIndexReader {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        let full_path = store.relative_path(path);
 | 
					        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) {
 | 
					        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);
 | 
					            bail!("unable to get shared lock on {:?} - {}", full_path, err);
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user