Skip to main content

amethystate_core/primitives/
error.rs

1use thiserror::Error;
2
3#[derive(Error, Debug)]
4pub enum FieldError<TStorageError> {
5    #[error(transparent)]
6    StorageError(#[from] TStorageError),
7
8    #[error("Change intercepted")]
9    Intercepted,
10
11    #[error("Key not found in Field: {0}")]
12    KeyNotFound(String),
13}
14
15pub type ReactiveFieldResult<T, E> = std::result::Result<T, FieldError<E>>;
16
17#[derive(Error, Debug)]
18pub enum ReactiveMapError<TStorageError> {
19    #[error(transparent)]
20    StorageError(#[from] TStorageError),
21
22    #[error("Change intercepted")]
23    Intercepted,
24
25    #[error("Key not found in ReactiveMap: {0}")]
26    KeyNotFound(String),
27}
28
29pub type ReactiveMapResult<T, E> = std::result::Result<T, ReactiveMapError<E>>;