async_tiff/
error.rs

1//! Error handling.
2
3use std::fmt::Debug;
4use thiserror::Error;
5
6/// Enum with all errors in this crate.
7#[derive(Error, Debug)]
8#[non_exhaustive]
9pub enum AsyncTiffError {
10    /// End of file error.
11    #[error("End of File: expected to read {0} bytes, got {1}")]
12    EndOfFile(usize, usize),
13
14    /// General error.
15    #[error("General error: {0}")]
16    General(String),
17
18    /// IO Error.
19    #[error(transparent)]
20    IOError(#[from] std::io::Error),
21
22    /// Error while decoding JPEG data.
23    #[error(transparent)]
24    JPEGDecodingError(#[from] jpeg::Error),
25
26    /// Error while fetching data using object store.
27    #[error(transparent)]
28    ObjectStore(#[from] object_store::Error),
29
30    /// An error during TIFF tag parsing.
31    #[error(transparent)]
32    InternalTIFFError(#[from] crate::tiff::TiffError),
33
34    /// Reqwest error
35    #[error(transparent)]
36    ReqwestError(#[from] reqwest::Error),
37}
38
39/// Crate-specific result type.
40pub type AsyncTiffResult<T> = std::result::Result<T, AsyncTiffError>;