1use thiserror::Error;
2
3#[derive(Debug, Error)]
5pub enum PolySimError {
6 #[error("BigSMILES parse error: {0}")]
8 Parse(#[from] bigsmiles::ParseError),
9
10 #[error("Invalid build strategy: {0}")]
12 BuildStrategy(String),
13
14 #[error("No stochastic object (repeat units) found in BigSMILES")]
17 NoStochasticObject,
18
19 #[error("Incompatible repeat unit count for {architecture}: got {got}, need {need}")]
22 RepeatUnitCount {
23 architecture: &'static str,
24 got: usize,
25 need: usize,
26 },
27
28 #[error("Weight fractions must sum to 1.0 (got {sum:.4})")]
30 InvalidFractions { sum: f64 },
31
32 #[error(
35 "Ring number overflow: the repeat unit uses {max_ring} ring closure(s), \
36 SMILES maximum is {max_supported}"
37 )]
38 RingNumberOverflow { max_ring: u32, max_supported: u32 },
39}