1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
mod subscription;
use ::kvsd::KvsdError;
pub use subscription::SubscriptionRepository;

pub mod kvsd;
pub mod memory;
pub mod types;

#[derive(thiserror::Error, Debug)]
pub enum RepositoryError {
    #[error("internal error: {0}")]
    Internal(#[from] anyhow::Error),
}

impl RepositoryError {
    pub fn internal(err: impl Into<anyhow::Error>) -> Self {
        RepositoryError::Internal(err.into())
    }
}

impl From<KvsdError> for RepositoryError {
    fn from(value: KvsdError) -> Self {
        RepositoryError::Internal(value.into())
    }
}