#[derive(Debug)] pub enum DichroismError { UriDataExtract(String), ImageWrite(String), } impl std::error::Error for DichroismError {} impl std::fmt::Display for DichroismError { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { write!(f, "{}", self) } } impl From for DichroismError { fn from(e: image::ImageError) -> Self { Self::ImageWrite(e.to_string()) } } impl From for DichroismError { fn from(e: base64::DecodeError) -> Self { Self::UriDataExtract(e.to_string()) } }