replace expect with an error (#4542)

This commit is contained in:
Nikolay Volf 2017-02-15 21:03:36 +03:00 committed by Arkadiy Paronyan
parent 30d7872226
commit f4f7b83d1f
1 changed files with 3 additions and 1 deletions

View File

@ -271,7 +271,9 @@ impl SimpleSecretStore for EthMultiStore {
// Remove from cache
let mut cache = self.cache.write();
let is_empty = {
let mut accounts = cache.get_mut(address).expect("Entry exists, because it was returned by `get`; qed");
let mut accounts = cache.get_mut(address)
.ok_or(Error::InvalidAccount)?;
if let Some(position) = accounts.iter().position(|acc| acc == &account) {
accounts.remove(position);
}