Skip to content

Commit

Permalink
fix: inconsistent error message. (#251)
Browse files Browse the repository at this point in the history
* fix: inconsistent error message.

* feat: add changes document
  • Loading branch information
felsweg-iota committed Aug 26, 2021
1 parent badc31b commit ad57181
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changes/error-types-client.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"iota-stronghold": patch
---

- Add `actors::secure::StoreError::NotExisting` as proper error type for correct error handling in client.
8 changes: 7 additions & 1 deletion client/src/actors/secure.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@ pub enum VaultError {
AccessError,
}

#[derive(DeriveError, Debug)]
pub enum StoreError {
#[error("Unable to read from store")]
NotExisting,
}

#[derive(DeriveError, Debug)]
pub enum SnapshotError {
#[error("No snapshot present for client id ({0})")]
Expand Down Expand Up @@ -654,7 +660,7 @@ impl_handler!(

match self.read_from_store(vault_id.into()) {
Some(data) => Ok(data),
None => Err(anyhow::anyhow!(VaultError::NotExisting)), // semantically wrong, use store error
None => Err(anyhow::anyhow!(StoreError::NotExisting)),
}
}
);
Expand Down

0 comments on commit ad57181

Please sign in to comment.