Fix Store::delete() for nonexistent IDs
If the ID does not exist, we should return an error instead of doing nothing, shouldn't we?
This commit is contained in:
parent
8345ff8248
commit
fd41fe5998
1 changed files with 7 additions and 3 deletions
|
@ -573,9 +573,13 @@ impl Store {
|
|||
};
|
||||
|
||||
// if the entry is currently modified by the user, we cannot drop it
|
||||
if entries.get(&id).map(|e| e.is_borrowed()).unwrap_or(false) {
|
||||
return Err(SE::new(SEK::IdLocked, None))
|
||||
.map_err_into(SEK::DeleteCallError);
|
||||
match entries.get(&id) {
|
||||
None => {
|
||||
return Err(SEK::FileNotFound.into_error()).map_err_into(SEK::DeleteCallError)
|
||||
},
|
||||
Some(e) => if e.is_borrowed() {
|
||||
return Err(SE::new(SEK::IdLocked, None)).map_err_into(SEK::DeleteCallError)
|
||||
}
|
||||
}
|
||||
|
||||
// remove the entry first, then the file
|
||||
|
|
Loading…
Reference in a new issue