honeycomb_core/cmap/
error.rs

1//! Main error type
2
3use crate::{attributes::AttributeError, cmap::DartIdType};
4
5/// Link operation error enum
6#[derive(Debug, thiserror::Error, PartialEq, Eq)]
7pub enum LinkError {
8    /// The base dart is not free.
9    #[error("cannot link {1} to {2}: b{0}({1}) != NULL")]
10    NonFreeBase(u8, DartIdType, DartIdType),
11    /// The image dart is not free
12    #[error("cannot link {1} to {2}: b{0}({2}) != NULL")]
13    NonFreeImage(u8, DartIdType, DartIdType),
14    /// The dart is already free.
15    #[error("cannot unlink {1}: b{0}({1}) == NULL")]
16    AlreadyFree(u8, DartIdType),
17    /// The two orbits being linked have different structures.
18    #[error("cannot 3-link {0} and {1}: faces do not have the same structure")]
19    AsymmetricalFaces(DartIdType, DartIdType),
20}
21
22/// Sew operation error enum
23#[derive(Debug, thiserror::Error, PartialEq, Eq)]
24pub enum SewError {
25    /// Geometry predicate failed verification.
26    #[error("cannot {0}-sew darts {1} and {2} due to geometry predicates")]
27    BadGeometry(u8, DartIdType, DartIdType),
28    /// Dart link failed.
29    #[error("inner link failed: {0}")]
30    FailedLink(#[from] LinkError),
31    /// Attribute operation failed.
32    #[error("attribute operation failed: {0}")]
33    FailedAttributeOp(#[from] AttributeError),
34}