1use std::error::Error;
2use std::fmt;
3
4#[derive(Clone, Debug, Eq, PartialEq)]
6pub enum BondValidationError {
7 EmptyEndpointLabel,
9 EmptyParticipantLabel,
11 EmptyDescriptor,
13 EmptyAngleLabel,
15 EmptyLengthUnit,
17 NonFiniteBondLength,
19 NonPositiveBondLength,
21 ZeroFractionalBondOrderNumerator,
23 ZeroFractionalBondOrderDenominator,
25}
26
27impl fmt::Display for BondValidationError {
28 fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
29 match self {
30 Self::EmptyEndpointLabel => {
31 formatter.write_str("bond endpoint label must not be empty")
32 },
33 Self::EmptyParticipantLabel => {
34 formatter.write_str("bond participant label must not be empty")
35 },
36 Self::EmptyDescriptor => formatter.write_str("bond descriptor must not be empty"),
37 Self::EmptyAngleLabel => formatter.write_str("bond angle label must not be empty"),
38 Self::EmptyLengthUnit => formatter.write_str("bond length unit must not be empty"),
39 Self::NonFiniteBondLength => formatter.write_str("bond length must be finite"),
40 Self::NonPositiveBondLength => formatter.write_str("bond length must be positive"),
41 Self::ZeroFractionalBondOrderNumerator => {
42 formatter.write_str("fractional bond order numerator must not be zero")
43 },
44 Self::ZeroFractionalBondOrderDenominator => {
45 formatter.write_str("fractional bond order denominator must not be zero")
46 },
47 }
48 }
49}
50
51impl Error for BondValidationError {}