Add param to EntryAlreadyExists error
This commit is contained in:
parent
83f9350d98
commit
6aa695974c
3 changed files with 8 additions and 6 deletions
|
@ -143,9 +143,9 @@ error_chain! {
|
|||
display("Entry is already borrowed: {:?}", id)
|
||||
}
|
||||
|
||||
EntryAlreadyExists {
|
||||
EntryAlreadyExists(id: StoreId) {
|
||||
description("Entry already exists")
|
||||
display("Entry already exists")
|
||||
display("Entry already exists: {:?}", id)
|
||||
}
|
||||
|
||||
MalformedEntry {
|
||||
|
|
|
@ -404,7 +404,8 @@ impl Store {
|
|||
|
||||
if hsmap.contains_key(&id) {
|
||||
debug!("Cannot create, internal cache already contains: '{}'", id);
|
||||
return Err(SE::from_kind(SEK::EntryAlreadyExists)).chain_err(|| SEK::CreateCallError);
|
||||
return Err(SE::from_kind(SEK::EntryAlreadyExists(id.clone())))
|
||||
.chain_err(|| SEK::CreateCallError);
|
||||
}
|
||||
hsmap.insert(id.clone(), {
|
||||
debug!("Creating: '{}'", id);
|
||||
|
@ -675,7 +676,8 @@ impl Store {
|
|||
);
|
||||
|
||||
if hsmap.contains_key(&new_id) {
|
||||
return Err(SE::from_kind(SEK::EntryAlreadyExists)).chain_err(|| SEK::MoveCallError)
|
||||
return Err(SE::from_kind(SEK::EntryAlreadyExists(new_id.clone())))
|
||||
.chain_err(|| SEK::MoveCallError)
|
||||
}
|
||||
|
||||
let old_id = entry.get_location().clone();
|
||||
|
@ -741,7 +743,7 @@ impl Store {
|
|||
};
|
||||
|
||||
if hsmap.contains_key(&new_id) {
|
||||
return Err(SE::from_kind(SEK::EntryAlreadyExists));
|
||||
return Err(SE::from_kind(SEK::EntryAlreadyExists(new_id.clone())));
|
||||
}
|
||||
|
||||
// if we do not have an entry here, we fail in `FileAbstraction::rename()` below.
|
||||
|
|
|
@ -84,7 +84,7 @@ impl CategoryRegister for Store {
|
|||
.chain_err(|| CEK::HeaderWriteError)
|
||||
.chain_err(|| CEK::StoreWriteError)
|
||||
}
|
||||
Err(store_error) => if is_match!(store_error.kind(), &SEK::EntryAlreadyExists) {
|
||||
Err(store_error) => if is_match!(store_error.kind(), &SEK::EntryAlreadyExists(_)) {
|
||||
Ok(false)
|
||||
} else {
|
||||
Err(store_error).chain_err(|| CEK::StoreWriteError)
|
||||
|
|
Loading…
Reference in a new issue