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("overview index {0} is stored in a SubIFD and has no top-level TIFF IFD index")]
34 OverviewHasNoTopLevelIfdIndex(usize),
35
36 #[error("band index {0} is out of bounds")]
37 BandOutOfBounds(usize),
38
39 #[error("no pixel scale or transformation matrix found")]
40 NoGeoTransform,
41
42 #[error("{0}")]
43 Other(String),
44}