//! Crate error type.
//!
//! The variants cover the crate's domains (parsing, unknown satellites,
//! interpolation outside the sampled span). They are intentionally coarse and
//! will gain structured payloads as the modules grow.
use core::fmt;
/// Result alias for fallible `astrodynamics-gnss` operations.
pub type Result<T> = core::result::Result<T, Error>;
/// Errors produced by the `astrodynamics-gnss` crate.
#[derive(Debug, Clone, PartialEq, Eq)]
#[non_exhaustive]
pub enum Error {
/// A product (SP3/RINEX/IONEX) could not be parsed.
Parse(String),
/// A requested satellite is not present in the product.
UnknownSatellite(crate::GnssSatelliteId),
/// A requested epoch lies outside the sampled / valid span.
EpochOutOfRange,
}
impl fmt::Display for Error {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Error::Parse(msg) => write!(f, "parse error: {msg}"),
Error::UnknownSatellite(id) => write!(f, "unknown satellite: {id}"),
Error::EpochOutOfRange => write!(f, "epoch out of range"),
}
}
}
impl std::error::Error for Error {}