From 83f9350d984fac726ce459472e673a99a7a46e2e Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Sat, 9 Sep 2017 21:36:35 +0200 Subject: [PATCH] Add param to EntryAlreadyBorrowed error --- lib/core/libimagstore/src/error.rs | 4 ++-- lib/core/libimagstore/src/store.rs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/core/libimagstore/src/error.rs b/lib/core/libimagstore/src/error.rs index 004e0b60..ce534833 100644 --- a/lib/core/libimagstore/src/error.rs +++ b/lib/core/libimagstore/src/error.rs @@ -138,9 +138,9 @@ error_chain! { display("The internal Store Lock has been poisoned") } - EntryAlreadyBorrowed { + EntryAlreadyBorrowed(id: StoreId) { description("Entry is already borrowed") - display("Entry is already borrowed") + display("Entry is already borrowed: {:?}", id) } EntryAlreadyExists { diff --git a/lib/core/libimagstore/src/store.rs b/lib/core/libimagstore/src/store.rs index bc9fa77d..e1ca17a1 100644 --- a/lib/core/libimagstore/src/store.rs +++ b/lib/core/libimagstore/src/store.rs @@ -173,7 +173,7 @@ impl StoreEntry { Err(err) }) } else { - Err(SE::from_kind(SEK::EntryAlreadyBorrowed)) + Err(SE::from_kind(SEK::EntryAlreadyBorrowed(self.id.clone()))) } } @@ -748,7 +748,7 @@ impl Store { // if we have one, but it is borrowed, we really should not rename it, as this might // lead to strange errors if hsmap.get(&old_id).map(|e| e.is_borrowed()).unwrap_or(false) { - return Err(SE::from_kind(SEK::EntryAlreadyBorrowed)); + return Err(SE::from_kind(SEK::EntryAlreadyBorrowed(old_id.clone()))); } let old_id_pb = try!(old_id.clone().with_base(self.path().clone()).into_pathbuf());