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#[derive(Debug, Error)]
11pub enum ParsingError {
12 #[error("invalid doris file")]
13 InvalidDoris,
14
15 #[error("header line too short (invalid)")]
16 HeaderLineTooShort,
17
18 #[error("file version parsing error")]
19 Version,
20
21 #[error("failed to parse epoch flag")]
22 EpochFlag,
23
24 #[error("failed to parse phase observation flag")]
25 ObservationFlag,
26
27 #[error("observation SNR parsing error")]
28 SNR,
29
30 #[error("observable parsing error")]
31 Observable,
32
33 #[error("invalid receiver format")]
34 Receiver,
35
36 #[error("invalid frequency")]
37 Frequency,
38
39 #[error("COSPAR number parsing: {0}")]
40 COSPAR(#[from] CosparParsingError),
41
42 #[error("DOMES site number parsing: {0}")]
43 DOMES(#[from] DOMESParsingError),
44
45 #[error("L1/L2 date offset parsing error")]
46 DorisL1L2DateOffset,
47
48 #[error("ground station parsing error")]
49 GroundStation,
50
51 #[error("epoch error: {0}")]
52 Epoch(#[from] HifitimeError),
53
54 #[error("invalid epoch format")]
55 EpochFormat,
56
57 #[error("epoch parsing error: {0}")]
58 EpochParsing(#[from] HifitimeParsingError),
59
60 #[error("not a standardized file name")]
61 NonStandardFileName,
62
63 #[error("failed to parse station clock offset")]
64 ClockOffset,
65
66 #[error("invalid station format")]
67 StationFormat,
68}
69
70#[derive(Error, Debug)]
72pub enum FormattingError {
73 #[error("i/o: output error")]
74 OutputError(#[from] IoError),
75}
76
77#[derive(Error, Debug)]
78pub enum Error {
79 #[error("failed to determine sampling rate")]
80 UndeterminedSamplingRate,
81}