sgp4/
gp.rs

1/// Represents a propagation error caused by orbital elements divergence
2#[derive(Debug, Clone)]
3pub enum Error {
4    OutOfRangeEccentricity {
5        /// Eccentricity value (unitless)
6        eccentricity: f64,
7
8        /// Minutes since epoch
9        t: f64,
10    },
11
12    OutOfRangePerturbedEccentricity {
13        /// Eccentricity value (unitless)
14        eccentricity: f64,
15
16        /// Minutes since epoch
17        t: f64,
18    },
19
20    NegativeSemiLatusRectum {
21        /// Minutes since epoch
22        t: f64,
23    },
24}
25
26impl core::fmt::Display for Error {
27    fn fmt(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
28        match self {
29            Error::OutOfRangeEccentricity { eccentricity, t } => formatter.write_fmt(
30                core::format_args!(
31                    "The propagated eccentricity ({}) is outside the range [0, 1[ {} minutes after epoch (before adding third-body perturbations)",
32                    eccentricity,
33                    t,
34                )
35            ),
36            Error::OutOfRangePerturbedEccentricity { eccentricity, t } => formatter.write_fmt(
37                core::format_args!(
38                    "The propagated eccentricity ({}) is outside the range [0, 1[ {} minutes after epoch (after adding third-body perturbations)",
39                    eccentricity,
40                    t,
41                )
42            ),
43            Error::NegativeSemiLatusRectum { t } => formatter.write_fmt(
44                core::format_args!("The propagated semi-latus rectum is negative {} minutes after epoch", t)
45            )
46        }
47    }
48}
49
50#[cfg(feature = "std")]
51impl std::error::Error for Error {}