Skip to main content

geotiff_reader/
error.rs

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(any(feature = "cog", feature = "cog-async"))]
16    Http(#[from] reqwest::Error),
17
18    #[error("not a GeoTIFF: missing GeoTIFF metadata")]
19    NotGeoTiff,
20
21    #[error("invalid GeoKey directory")]
22    InvalidGeoKeyDirectory,
23
24    #[error("invalid GeoTIFF tag {tag}: {reason}")]
25    InvalidGeoTiffTag { tag: u16, reason: String },
26
27    #[error("overview index {0} not found")]
28    OverviewNotFound(usize),
29
30    #[error("overview index {0} is stored in a SubIFD and has no top-level TIFF IFD index")]
31    OverviewHasNoTopLevelIfdIndex(usize),
32
33    #[error("{0}")]
34    Other(String),
35}