Skip to main content

hirn_engine/
error.rs

1use hirn_core::HirnError;
2
3/// Internal storage error conversions.
4#[derive(Debug, thiserror::Error)]
5pub enum StoreError {
6    #[error("serialization error: {0}")]
7    Serialization(String),
8}
9
10impl From<bincode::Error> for StoreError {
11    fn from(err: bincode::Error) -> Self {
12        Self::Serialization(err.to_string())
13    }
14}
15
16impl From<StoreError> for HirnError {
17    fn from(err: StoreError) -> Self {
18        match err {
19            StoreError::Serialization(msg) => Self::DatabaseCorrupted(msg),
20        }
21    }
22}