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(
22 "Incompatible repeat unit count for {architecture}: got {got}, need at least {need_min}"
23 )]
24 RepeatUnitCount {
25 architecture: &'static str,
26 got: usize,
27 need_min: usize,
28 },
29
30 #[error("Block ratios must sum to 1.0 (got {sum:.4})")]
32 InvalidBlockRatios { sum: f64 },
33
34 #[error("Weight fractions must sum to 1.0 (got {sum:.4})")]
36 InvalidFractions { sum: f64 },
37
38 #[error("Cannot create an ensemble with zero chains")]
40 EmptyEnsemble,
41
42 #[error(
45 "Ring number overflow: the repeat unit uses {max_ring} ring closure(s), \
46 SMILES maximum is {max_supported}"
47 )]
48 RingNumberOverflow { max_ring: u32, max_supported: u32 },
49}