use thiserror::Error;
#[derive(Debug, Error, Clone, PartialEq, Eq)]
#[non_exhaustive]
pub enum LunarError {
#[error("Invalid solar date: {year:04}-{month:02}-{day:02}")]
InvalidSolarDate { year: i32, month: u8, day: u8 },
#[error("Invalid lunar date: {year:04}-{month:02}-{day:02}, is_leap_month={is_leap_month}")]
InvalidLunarDate {
year: i32,
month: u8,
day: u8,
is_leap_month: bool,
},
#[error("Invalid lunar month: {year:04}-{month:02}, is_leap_month={is_leap_month}")]
InvalidLunarMonth {
year: i32,
month: u8,
is_leap_month: bool,
},
#[error("Solar year {year} is out of supported range")]
SolarYearOutOfRange { year: i32 },
#[error("Lunar year {year} is out of supported range")]
LunarYearOutOfRange { year: i32 },
#[error("Invalid time: {hour:02}:{minute:02}")]
InvalidTime { hour: u8, minute: u8 },
#[error("Invalid time index: {time_index} (expected 0..=12)")]
InvalidTimeIndex { time_index: u8 },
}
#[derive(Debug, Error, Clone, PartialEq, Eq)]
#[non_exhaustive]
pub enum StemBranchError {
#[error("Invalid stem-branch pair: {stem:?} - {branch:?}")]
InvalidStemBranchPair {
stem: crate::stem_branch::HeavenlyStem,
branch: crate::stem_branch::EarthlyBranch,
},
}