use std::error::Error;
use std::fmt;
#[derive(Clone, Debug, Eq, PartialEq)]
pub enum BondValidationError {
EmptyEndpointLabel,
EmptyParticipantLabel,
EmptyDescriptor,
EmptyAngleLabel,
EmptyLengthUnit,
NonFiniteBondLength,
NonPositiveBondLength,
ZeroFractionalBondOrderNumerator,
ZeroFractionalBondOrderDenominator,
}
impl fmt::Display for BondValidationError {
fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::EmptyEndpointLabel => {
formatter.write_str("bond endpoint label must not be empty")
},
Self::EmptyParticipantLabel => {
formatter.write_str("bond participant label must not be empty")
},
Self::EmptyDescriptor => formatter.write_str("bond descriptor must not be empty"),
Self::EmptyAngleLabel => formatter.write_str("bond angle label must not be empty"),
Self::EmptyLengthUnit => formatter.write_str("bond length unit must not be empty"),
Self::NonFiniteBondLength => formatter.write_str("bond length must be finite"),
Self::NonPositiveBondLength => formatter.write_str("bond length must be positive"),
Self::ZeroFractionalBondOrderNumerator => {
formatter.write_str("fractional bond order numerator must not be zero")
},
Self::ZeroFractionalBondOrderDenominator => {
formatter.write_str("fractional bond order denominator must not be zero")
},
}
}
}
impl Error for BondValidationError {}