use crate::astronomy::star::error::Error as StarError;
#[derive(Clone, Copy, Debug, Eq, Error, Hash, PartialEq)]
pub enum Error {
#[error("an error occurred in the star ({0})")]
StarError(#[from] StarError),
#[error("the stars are too close together to be stable")]
BinaryStarsTooCloseForComfort,
#[error("the stars' habitable zone is contained within their forbidden zone")]
HabitableZoneContainedWithinForbiddenZone,
#[error("the stars' habitable zone is too close to the host stars")]
HabitableZoneContainedWithinDangerZone,
#[error("the stars do not have a habitable zone")]
NoHabitableZoneFound,
#[error("an unknown error occurred")]
UnknownError,
}
#[cfg(test)]
pub mod test {
use super::*;
use crate::test::*;
#[named]
#[test]
pub fn test_errors() {
init();
trace_enter!();
let mut error = Error::BinaryStarsTooCloseForComfort;
print_var!(error);
error = Error::HabitableZoneContainedWithinForbiddenZone;
print_var!(error);
error = Error::HabitableZoneContainedWithinDangerZone;
print_var!(error);
error = Error::NoHabitableZoneFound;
print_var!(error);
error = Error::UnknownError;
print_var!(error);
error = Error::StarError(StarError::UnknownError);
print_var!(error);
error = StarError::UnknownError.into();
print_var!(error);
trace_exit!();
}
}