doris_rs/
error.rs

1use thiserror::Error;
2
3use gnss_rs::{cospar::Error as CosparParsingError, domes::Error as DOMESParsingError};
4
5use hifitime::{HifitimeError, ParsingError as HifitimeParsingError};
6
7use std::io::Error as IoError;
8
9/// Errors that may rise when parsing DORIS files
10#[derive(Debug, Error)]
11pub enum ParsingError {
12    #[error("file I/O error: {0}")]
13    FileIO(#[from] std::io::Error),
14
15    #[error("invalid doris file")]
16    InvalidDoris,
17
18    #[error("header line too short (invalid)")]
19    HeaderLineTooShort,
20
21    #[error("file version parsing error")]
22    Version,
23
24    #[error("failed to parse epoch flag")]
25    EpochFlag,
26
27    #[error("failed to parse phase observation flag")]
28    ObservationFlag,
29
30    #[error("observation SNR parsing error")]
31    SNR,
32
33    #[error("observable parsing error")]
34    Observable,
35
36    #[error("invalid receiver format")]
37    Receiver,
38
39    #[error("invalid frequency")]
40    Frequency,
41
42    #[error("COSPAR number parsing: {0}")]
43    COSPAR(#[from] CosparParsingError),
44
45    #[error("DOMES site number parsing: {0}")]
46    DOMES(#[from] DOMESParsingError),
47
48    #[error("L1/L2 date offset parsing error")]
49    DorisL1L2DateOffset,
50
51    #[error("ground station parsing error")]
52    GroundStation,
53
54    #[error("epoch error: {0}")]
55    Epoch(#[from] HifitimeError),
56
57    #[error("invalid epoch format")]
58    EpochFormat,
59
60    #[error("epoch parsing error: {0}")]
61    EpochParsing(#[from] HifitimeParsingError),
62
63    #[error("not a standardized file name")]
64    NonStandardFileName,
65
66    #[error("failed to parse station clock offset")]
67    ClockOffset,
68
69    #[error("invalid station format")]
70    StationFormat,
71}
72
73/// Errors that may rise when formatting DORIS files
74#[derive(Error, Debug)]
75pub enum FormattingError {
76    #[error("i/o: output error")]
77    OutputError(#[from] IoError),
78}