Skip to main content

tpt_sci_astro/
error.rs

1//! Error types for `tpt-sci-astro`.
2
3use thiserror::Error;
4
5/// Errors produced by the astrodynamics primitives.
6#[derive(Debug, Clone, PartialEq, Error)]
7pub enum AstroError {
8    /// An input failed a physical/mathematical invariant (e.g. `a ≤ 0`,
9    /// `e ∉ [0, 1)`, non-finite angle, or `μ ≤ 0`).
10    #[error("invalid orbital elements: {0}")]
11    InvalidElements(String),
12    /// The input geometry was degenerate and could not be transformed
13    /// (e.g. zero position magnitude, zero angular momentum, or a
14    /// non-elliptical orbit).
15    #[error("degenerate geometry: {0}")]
16    DegenerateGeometry(String),
17}