1use thiserror::Error;
2
3pub type Result<T> = std::result::Result<T, Error>;
4
5#[derive(Debug, Error)]
6pub enum Error {
7 #[error("I/O error reading {1}: {0}")]
8 Io(#[source] std::io::Error, String),
9
10 #[error("TIFF error: {0}")]
11 #[cfg(feature = "local")]
12 Tiff(#[from] tiff_reader::TiffError),
13
14 #[error("HTTP error: {0}")]
15 #[cfg(feature = "cog")]
16 Http(#[from] reqwest::Error),
17
18 #[error("not a GeoTIFF: missing GeoKey directory (tag 34735)")]
19 NotGeoTiff,
20
21 #[error("invalid GeoKey directory")]
22 InvalidGeoKeyDirectory,
23
24 #[error("unsupported GeoKey model type: {0}")]
25 UnsupportedModelType(u16),
26
27 #[error("EPSG code {0} not recognized")]
28 UnknownEpsg(u32),
29
30 #[error("overview index {0} not found")]
31 OverviewNotFound(usize),
32
33 #[error("band index {0} is out of bounds")]
34 BandOutOfBounds(usize),
35
36 #[error("no pixel scale or transformation matrix found")]
37 NoGeoTransform,
38
39 #[error("{0}")]
40 Other(String),
41}