sovran_typemap/error.rs
1use std::fmt;
2
3/// Errors that can occur when using TypeStore
4#[derive(Debug)]
5pub enum StoreError {
6 /// Failed to acquire lock on the store
7 LockError,
8 /// The requested key was not found
9 KeyNotFound,
10 /// Attempted to access a value with a type that doesn't match what was stored
11 TypeMismatch,
12}
13
14impl fmt::Display for StoreError {
15 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
16 match self {
17 StoreError::LockError => write!(f, "Failed to acquire lock"),
18 StoreError::KeyNotFound => write!(f, "Key not found in store"),
19 StoreError::TypeMismatch => write!(f, "Type mismatch for the requested key"),
20 }
21 }
22}
23
24impl std::error::Error for StoreError {}