1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
use sic_core::errors::SicCoreError; use sic_core::image::ImageError; use std::path::PathBuf; use thiserror::Error; #[derive(Debug, Error)] pub enum SicIoError { #[error("{0}")] SicCoreError(#[from] SicCoreError), #[error("{0}")] ImageError(#[from] ImageError), #[error("{0}")] Io(std::io::Error), #[error("{0}")] FormatError(FormatError), #[error( "An input image should be given by providing a path using the input argument or by \ piping an image to the stdin." )] NoInputImage, #[error("Unable to extract frame {0} from the (animated) image; please use a frame index between 0 and {1}.")] NoSuchFrame(usize, usize), #[error("An animated image was expected, but a static image was given")] NotAnAnimatedImage, #[error( "No supported image output format was found. The following identifier was provided: {0}." )] UnknownImageIdentifier(String), #[error( "Unable to determine the image format from the file extension. The following path was given: {0}." )] UnableToDetermineImageFormatFromFileExtension(PathBuf), } #[derive(Debug, Error)] pub enum FormatError { #[error("Unable to determine JPEG quality.")] JPEGQualityLevelNotSet, #[error("JPEG Quality should range between 1 and 100 (inclusive).")] JPEGQualityLevelNotInRange, #[error("Using PNM requires the sample encoding to be set.")] PNMSamplingEncodingNotSet, }