stac_io/
error.rs

1use thiserror::Error;
2
3/// Crate-specific error enum
4#[derive(Error, Debug)]
5#[non_exhaustive]
6pub enum Error {
7    /// An error occurred when getting an href.
8    #[error("error when getting href={href}: {message}")]
9    Get {
10        /// The href that we were trying to get.
11        href: String,
12
13        /// The underling error message.
14        message: String,
15    },
16
17    /// A required feature is not enabled.
18    #[error("{0} is not enabled")]
19    FeatureNotEnabled(&'static str),
20
21    /// Returned when unable to read a STAC value from a path.
22    #[error("{io}: {path}")]
23    FromPath {
24        /// The [std::io::Error]
25        #[source]
26        io: std::io::Error,
27
28        /// The path.
29        path: String,
30    },
31
32    /// [std::io::Error]
33    #[error(transparent)]
34    Io(#[from] std::io::Error),
35
36    #[cfg(feature = "store")]
37    #[error(transparent)]
38    /// [object_store::Error]
39    ObjectStore(#[from] object_store::Error),
40
41    #[cfg(feature = "geoparquet")]
42    #[error(transparent)]
43    /// [parquet::errors::ParquetError]
44    Parquet(#[from] parquet::errors::ParquetError),
45
46    #[cfg(feature = "reqwest")]
47    #[error(transparent)]
48    /// [reqwest::Error]
49    Reqwest(#[from] reqwest::Error),
50
51    #[error(transparent)]
52    /// [serde_json::Error]
53    SerdeJson(#[from] serde_json::Error),
54
55    #[error(transparent)]
56    /// [stac::Error]
57    Stac(#[from] stac::Error),
58
59    /// Unsupported file format.
60    #[error("unsupported format: {0}")]
61    UnsupportedFormat(String),
62
63    /// [url::ParseError]
64    #[error(transparent)]
65    UrlParse(#[from] url::ParseError),
66}