pub enum StoreError {
KeyNotFound(String),
TypeMismatch(String),
LockError(String),
AppendTypeMismatch(String),
Generic(String),
}Expand description
Comprehensive error type for store operations
This enum covers all the different ways store operations can fail. Each variant provides specific information about what went wrong and helps users understand how to fix the issue.
§Error Categories
KeyNotFound: The requested key doesn’t exist in storeTypeMismatch: The stored value can’t be cast to the requested typeLockError: Failed to acquire read/write lock on storeAppendTypeMismatch: Tried to append to a value that isn’t aVec<TState>Generic: General store errors with custom messages
Variants§
KeyNotFound(String)
The requested key was not found in store
This error occurs when trying to access a key that doesn’t exist. Common causes: typos in key names, accessing data before it’s stored, or data being removed by another operation.
TypeMismatch(String)
Type mismatch when retrieving stored value
This error occurs when the stored value can’t be downcast to the requested type. Common causes: storing one type and requesting another, or inconsistent type usage across nodes.
LockError(String)
Failed to acquire lock on store
This error occurs when the store lock is poisoned or unavailable. Common causes: panic in another thread while holding the lock, or deadlock situations.
AppendTypeMismatch(String)
Attempted to append to a value that isn’t a Vec<TState>
This error occurs when trying to append to an existing key that
contains a value of a different type than Vec<TState>.
Generic(String)
General store error with custom message
Use this for store errors that don’t fit other categories. Provide a descriptive message about what went wrong.
Implementations§
Source§impl StoreError
impl StoreError
Sourcepub fn key_not_found<TStore: Into<String>>(key: TStore) -> Self
pub fn key_not_found<TStore: Into<String>>(key: TStore) -> Self
Create a new key not found error
Sourcepub fn type_mismatch<TStore: Into<String>>(msg: TStore) -> Self
pub fn type_mismatch<TStore: Into<String>>(msg: TStore) -> Self
Create a new type mismatch error
Sourcepub fn lock_error<TStore: Into<String>>(msg: TStore) -> Self
pub fn lock_error<TStore: Into<String>>(msg: TStore) -> Self
Create a new lock error
Sourcepub fn append_type_mismatch<TStore: Into<String>>(key: TStore) -> Self
pub fn append_type_mismatch<TStore: Into<String>>(key: TStore) -> Self
Create a new append type mismatch error
Trait Implementations§
Source§impl Clone for StoreError
impl Clone for StoreError
Source§fn clone(&self) -> StoreError
fn clone(&self) -> StoreError
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more