Add missing error handling

We don't want to panick if a lock inside the store is broken. We want to
notify the user, so she can start panicking.
This commit is contained in:
Julian Ganz 2016-01-25 20:38:45 +01:00
parent 4a08eed700
commit 1085127036

View file

@ -193,6 +193,10 @@ impl Store {
/// Delete an entry
pub fn delete(&self, id: StoreId) -> Result<()> {
let mut entries_lock = self.entries.write();
if entries_lock.is_err() {
return Err(StoreError::new(StoreErrorKind::LockPoisoned, None))
}
let mut entries = entries_lock.unwrap();
// if the entry is currently modified by the user, we cannot drop it