csw_core/
error.rs

1//! Error types for categorical specification validation.
2
3use thiserror::Error;
4
5/// Errors that can occur when building or validating a categorical specification.
6#[derive(Debug, Error, Clone, PartialEq, Eq)]
7pub enum ValidationError {
8    /// Exponentials require products to be present.
9    #[error("exponentials require products: cannot have function types without pair types")]
10    ExponentialsRequireProducts,
11
12    /// Linear hom requires tensor to be present.
13    #[error("linear hom (⊸) requires tensor (⊗): cannot have linear functions without tensor product")]
14    LinearHomRequiresTensor,
15
16    /// Cartesian structure requires terminal object.
17    #[error("cartesian structure requires terminal object")]
18    CartesianRequiresTerminal,
19
20    /// Cartesian structure requires products.
21    #[error("cartesian structure requires products")]
22    CartesianRequiresProducts,
23
24    /// Invalid combination of structural rules.
25    #[error("invalid structural rule combination: {0}")]
26    InvalidStructuralRules(String),
27
28    /// Empty category name.
29    #[error("category name cannot be empty")]
30    EmptyName,
31
32    /// Duplicate base type.
33    #[error("duplicate base type: {0}")]
34    DuplicateBaseType(String),
35}