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:
parent
4a08eed700
commit
1085127036
1 changed files with 4 additions and 0 deletions
|
@ -193,6 +193,10 @@ impl Store {
|
||||||
/// Delete an entry
|
/// Delete an entry
|
||||||
pub fn delete(&self, id: StoreId) -> Result<()> {
|
pub fn delete(&self, id: StoreId) -> Result<()> {
|
||||||
let mut entries_lock = self.entries.write();
|
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();
|
let mut entries = entries_lock.unwrap();
|
||||||
|
|
||||||
// if the entry is currently modified by the user, we cannot drop it
|
// if the entry is currently modified by the user, we cannot drop it
|
||||||
|
|
Loading…
Reference in a new issue