Add parameter to IdNotFound error
This commit is contained in:
parent
b682e7f8db
commit
ca9123c740
2 changed files with 7 additions and 3 deletions
|
@ -17,6 +17,8 @@
|
||||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
//
|
//
|
||||||
|
|
||||||
|
use storeid::StoreId;
|
||||||
|
|
||||||
error_chain! {
|
error_chain! {
|
||||||
types {
|
types {
|
||||||
StoreError, StoreErrorKind, ResultExt, Result;
|
StoreError, StoreErrorKind, ResultExt, Result;
|
||||||
|
@ -69,9 +71,9 @@ error_chain! {
|
||||||
display("ID locked")
|
display("ID locked")
|
||||||
}
|
}
|
||||||
|
|
||||||
IdNotFound {
|
IdNotFound(sid: StoreId) {
|
||||||
description("ID not found")
|
description("ID not found")
|
||||||
display("ID not found")
|
display("ID not found: {}", sid)
|
||||||
}
|
}
|
||||||
|
|
||||||
OutOfMemory {
|
OutOfMemory {
|
||||||
|
|
|
@ -554,7 +554,9 @@ impl Store {
|
||||||
Ok(e) => e,
|
Ok(e) => e,
|
||||||
};
|
};
|
||||||
|
|
||||||
let se = try!(hsmap.get_mut(&entry.location).ok_or(SE::from_kind(SEK::IdNotFound)));
|
let se = try!(hsmap.get_mut(&entry.location).ok_or_else(|| {
|
||||||
|
SE::from_kind(SEK::IdNotFound(entry.location.clone()))
|
||||||
|
}));
|
||||||
|
|
||||||
assert!(se.is_borrowed(), "Tried to update a non borrowed entry.");
|
assert!(se.is_borrowed(), "Tried to update a non borrowed entry.");
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue