1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
//! 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,
/// An operation received inputs it cannot combine (e.g. an empty set of
/// products to merge, or products on mismatched time scales, epoch grids, or
/// coordinate-system labels).
InvalidInput(String),
}
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"),
Error::InvalidInput(msg) => write!(f, "invalid input: {msg}"),
}
}
}
impl std::error::Error for Error {}