use std::error::Error;
use std::fmt::{Display, Error as FmtError, Formatter};
#[derive(Debug, Eq, PartialEq)]
pub enum LunisolarError {
OutOfSolarRange,
IncorrectSolarYear,
IncorrectSolarMonth,
IncorrectSolarDay,
OutOfLunarRange,
IncorrectLunisolarYear,
IncorrectLunarMonth,
IncorrectLunarDay,
}
impl Display for LunisolarError {
#[inline]
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> {
match self {
LunisolarError::OutOfSolarRange => f.write_str("The solar date range is out of range."),
LunisolarError::IncorrectSolarYear => f.write_str("The solar year is incorrect."),
LunisolarError::IncorrectSolarMonth => f.write_str("The solar month is incorrect."),
LunisolarError::IncorrectSolarDay => f.write_str("The solar day is incorrect."),
LunisolarError::OutOfLunarRange => f.write_str("The lunar date range is out of range."),
LunisolarError::IncorrectLunisolarYear => f.write_str("The lunar year is incorrect."),
LunisolarError::IncorrectLunarMonth => f.write_str("The lunar month is incorrect."),
LunisolarError::IncorrectLunarDay => f.write_str("The lunar day is incorrect."),
}
}
}
impl Error for LunisolarError {}