1use thiserror::Error;
3
4#[derive(Debug, Error)]
7pub enum Error {
8 #[error("{0}: {1}")]
10 IO(String, #[source] std::io::Error),
11
12 #[error("{0}")]
14 Json(#[from] serde_json::Error),
15
16 #[error("Unknown builtin catalog")]
18 UnknownCatalog,
19
20 #[error("Unknown builtin catalog extension")]
22 UnknownCatalogExtension,
23
24 #[error("Failed to find Id {0} in the catalog")]
26 FailedToFindId(usize),
27
28 #[error("Failed to find star name in the catalog")]
31 FailedToFindName,
32
33 #[cfg(feature = "csv")]
34 #[error("Failed to read CSV file: {0}")]
36 CsvError(#[from] csv::Error),
37
38 #[cfg(feature = "postcard")]
39 #[error("Failed to read Postcard file: {0}")]
41 Postcard(#[from] postcard::Error),
42}
43
44impl std::convert::From<(std::io::Error, String)> for Error {
45 fn from((e, s): (std::io::Error, String)) -> Error {
46 Error::IO(s, e)
47 }
48}