[Task] Design and implement a StorageError
#920
Labels
Breaking change
A change to the API that requires a major release. Part of "Changed" section in changelog
Rust
Related to the core Rust code. Becomes part of the Rust changelog.
Wasm
Related to Wasm bindings. Becomes part of the Wasm changelog
Description
Design and implement a
StorageError
that is returned from allStorage
methods asResult<T, StorageError>
.For the design, we could take inspiration from
serde::de::Error
and how it handles custom errors.We should consider providing some common variants that all implementations likely need:
Using
Box<dyn std::error::Error>
allows a caller to downcast to a concrete error type in case they want to handle errors from a specific implementation.Motivation
The
Storage
trait currently usesidentity_account_storage::error::Result
in its return type, which means theAccount
error type needs to accommodate the possible storage error from bothMemStore
andStronghold
, as well as Wasm-specific variant such asidentity_account_storage::error::Error::{SerializationError,JsError}
. A dedicatedStorageError
allows for independent error types for our two implementations, as well as external implementations, and without polluting the existing error.Resources
#597 (comment)
To-do list
Create a task-specific to-do list. Please link PRs that match the To-do list item behind the item after it has been submitted.
MemStoreError
that contains the specific errors from the accountError
type that only theMemStore
needs.parking_lot::RwLock
instead ofstd::sync::RwLock
and get rid of theSharedReadPoisoned
andSharedWritePoisoned
error variants.StorageError
.Change checklist
Add an
x
to the boxes that are relevant to your changes, and delete any items that are not.The text was updated successfully, but these errors were encountered: