1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
use thiserror::Error;

use crate::backend::error::BackendError;

#[derive(Error, Debug)]
pub enum StorageError {
    #[error("The stream doesn't exists")]
    StreamDoesntExists,
    #[error("The stream already exists")]
    StreamAlreadyExists,
    #[error("BackendError: {0}")]
    InternalBackendError(Box<dyn BackendError>),
}

impl<T> From<T> for StorageError
where
    T: BackendError,
{
    fn from(e: T) -> Self {
        Self::InternalBackendError(Box::new(e))
    }
}