pub type Result<T> = std::result::Result<T, GaiaDr3Error>;
#[derive(Debug, thiserror::Error, PartialEq)]
pub enum GaiaDr3Error {
#[error("required Gaia DR3 field `{field}` is missing")]
MissingRequiredField {
field: &'static str,
},
#[error("Gaia DR3 field `{field}` must be finite, got {value}")]
NonFinite {
field: &'static str,
value: f64,
},
#[error("Gaia DR3 right ascension must be in [0, 360) deg, got {value}")]
RightAscensionOutOfRange {
value: f64,
},
#[error("Gaia DR3 declination must be in [-90, 90] deg, got {value}")]
DeclinationOutOfRange {
value: f64,
},
#[error("Gaia DR3 field `{field}` must be positive, got {value}")]
NotPositive {
field: &'static str,
value: f64,
},
#[error("Gaia DR3 field `{field}` must be non-negative, got {value}")]
Negative {
field: &'static str,
value: f64,
},
#[error("Gaia XP sampled spectrum must contain at least one sample")]
EmptySpectrum,
#[error("Gaia XP sampled spectrum wavelengths must be strictly increasing")]
NonMonotonicSpectrum,
#[error("spectral band `{name}` has invalid bounds")]
InvalidSpectralBand {
name: &'static str,
},
#[error("Gaia XP sampled spectrum does not cover spectral band `{name}`")]
InsufficientBandCoverage {
name: &'static str,
},
#[error("required Gaia DR3 column `{column}` missing on row at line {line}")]
MissingColumn {
column: &'static str,
line: usize,
},
#[error("invalid Gaia DR3 number for column `{column}` on line {line}: {raw}")]
InvalidNumber {
column: &'static str,
line: usize,
raw: String,
},
}