honeycomb_core/cmap/
error.rs

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
26
27
28
29
30
31
32
//! Main error type

use stm::StmError;

/// Convenience type alias.
pub type CMapResult<T> = Result<T, CMapError>;

/// `CMap` error enum.
#[derive(Debug, thiserror::Error)]
pub enum CMapError {
    /// STM transaction failed.
    #[error("transaction failed")]
    FailedTransaction(/*#[from]*/ StmError),
    /// Attribute merge failed due to missing value(s).
    #[error("attribute merge failed: {0}")]
    FailedAttributeMerge(&'static str),
    /// Attribute split failed due to missing value.
    #[error("attribute split failed: {0}")]
    FailedAttributeSplit(&'static str),
    /// Geometry check failed.
    #[error("operation incompatible with map geometry: {0}")]
    IncorrectGeometry(&'static str),
    /// Accessed attribute isn't in the map storage.
    #[error("unknown attribute: {0}")]
    UnknownAttribute(&'static str),
}

impl From<StmError> for CMapError {
    fn from(value: StmError) -> Self {
        Self::FailedTransaction(value)
    }
}