1use image::ImageError;
4#[cfg(feature = "read-raw-image")]
5use rawloader::RawLoaderError;
6use std::fmt::{Debug, Display, Formatter};
7use std::io;
8use thiserror::Error;
9
10#[derive(Error, Debug)]
12pub struct RawPipelineError(pub String);
13
14impl Display for RawPipelineError {
15 fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
16 std::fmt::Display::fmt(&self.0, f)
17 }
18}
19
20impl From<String> for RawPipelineError {
21 fn from(value: String) -> Self {
22 Self(value)
23 }
24}
25
26#[derive(Error, Debug)]
28pub struct UnknownError(pub String);
29
30impl Display for UnknownError {
31 fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
32 std::fmt::Display::fmt(&self.0, f)
33 }
34}
35
36impl From<String> for UnknownError {
37 fn from(value: String) -> Self {
38 Self(value)
39 }
40}
41
42#[derive(Debug, Error)]
44pub enum Error {
45 #[error("Unable to decode raw image")]
47 #[cfg_attr(not(feature = "read-raw-image"), non_exhaustive)]
48 DecodeError(
49 #[from]
50 #[cfg(feature = "read-raw-image")]
51 RawLoaderError,
52 ),
53 #[error("Unable to decode raw image")]
55 RawPipeline(#[from] RawPipelineError),
56 #[error("Unable to read exif data")]
58 ExifError(#[from] exif::Error),
59 #[error("Unable to read file")]
61 IoError(#[from] io::Error),
62 #[error("Unable to process image")]
65 ImageError(#[from] ImageError),
66 #[error("Invalid value for {parameter_name:?}: {message:?}")]
68 InputError {
69 parameter_name: String,
71 message: String,
73 },
74 #[error("{0}")]
76 UnknownError(#[from] UnknownError),
77}