From 28b96b56e173e9f4525e63c7a3195b85fa68cbdc Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Sat, 22 Dec 2018 15:59:55 +0100 Subject: [PATCH] open_file_locked: improve error message --- src/tools.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/tools.rs b/src/tools.rs index 3c75bfff..30a8b190 100644 --- a/src/tools.rs +++ b/src/tools.rs @@ -109,8 +109,11 @@ pub fn open_file_locked>(path: P, timeout: Duration) Err(err) => bail!("Unable to open lock {:?} - {}", path, err), }; - lock_file(&mut file, true, Some(timeout))?; - Ok(file) + match lock_file(&mut file, true, Some(timeout)) { + Ok(_) => Ok(file), + Err(err) => bail!("Unable to aquire lock {:?} - {}", + path, err), + } } // Note: We cannot implement an Iterator, because Iterators cannot