1//! Main error type
23use crate::{attributes::AttributeError, cmap::DartIdType};
45/// 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")]
10NonFreeBase(u8, DartIdType, DartIdType),
11/// The image dart is not free
12#[error("cannot link {1} to {2}: b{0}({2}) != NULL")]
13NonFreeImage(u8, DartIdType, DartIdType),
14/// The dart is already free.
15#[error("cannot unlink {1}: b{0}({1}) == NULL")]
16AlreadyFree(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")]
19AsymmetricalFaces(DartIdType, DartIdType),
20}
2122/// 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")]
27BadGeometry(u8, DartIdType, DartIdType),
28/// Dart link failed.
29#[error("inner link failed: {0}")]
30FailedLink(#[from] LinkError),
31/// Attribute operation failed.
32#[error("attribute operation failed: {0}")]
33FailedAttributeOp(#[from] AttributeError),
34}