use crate::{attributes::AttributeError, cmap::DartIdType};
#[derive(Debug, thiserror::Error, PartialEq, Eq)]
#[error("cannot reserve {0} darts: not enough unused darts")]
pub struct DartReservationError(pub usize);
#[derive(Debug, thiserror::Error, PartialEq, Eq)]
#[error("cannot set dart {0} as unused: dart isn't free")]
pub struct DartReleaseError(pub DartIdType);
#[derive(Debug, thiserror::Error, PartialEq, Eq)]
pub enum LinkError {
#[error("cannot link {1} to {2}: b{0}({1}) != NULL")]
NonFreeBase(u8, DartIdType, DartIdType),
#[error("cannot link {1} to {2}: b{0}({2}) != NULL")]
NonFreeImage(u8, DartIdType, DartIdType),
#[error("cannot unlink {1}: b{0}({1}) == NULL")]
AlreadyFree(u8, DartIdType),
#[error("cannot 3-link {0} and {1}: faces do not have the same structure")]
AsymmetricalFaces(DartIdType, DartIdType),
}
#[derive(Debug, thiserror::Error, PartialEq, Eq)]
pub enum SewError {
#[error("cannot {0}-sew darts {1} and {2} due to geometry predicates")]
BadGeometry(u8, DartIdType, DartIdType),
#[error("inner link failed: {0}")]
FailedLink(#[from] LinkError),
#[error("attribute operation failed: {0}")]
FailedAttributeOp(#[from] AttributeError),
}