Something went wrong. Try again.
The smokesignal.events web application forked from smokesignal.events/smokesignal
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106use thiserror::Error;
/// Represents errors that can occur during image processing operations.////// These errors typically occur during image validation, resizing, format/// conversion, and aspect ratio verification.#[derive(Debug, Error)]pub(crate) enum ImageError { /// Error when image size exceeds the maximum allowed size. /// /// This error occurs when attempting to process an image that is larger /// than the specified maximum file size limit. #[error("error-smokesignal-image-1 Image size exceeds maximum: {size} bytes > {max} bytes")] SizeExceedsMaximum { /// The actual size of the image in bytes. size: usize, /// The maximum allowed size in bytes. max: usize, },
/// Error when image data is invalid or cannot be decoded. /// /// This error occurs when the provided data cannot be decoded as a valid /// image format, typically due to corrupted data or unsupported formats. #[error("error-smokesignal-image-2 Invalid image data: {0}")] InvalidImageData(String),
/// Error when loading an avatar image fails. /// /// This error occurs when attempting to load image data for avatar /// processing, typically due to invalid format or corrupted data. #[error("error-smokesignal-image-3 Failed to load avatar image: {0}")] AvatarLoadFailed(String),
/// Error when avatar aspect ratio is not 1:1. /// /// This error occurs when an avatar image doesn't have the required /// square aspect ratio (allowing 5% deviation). #[error("error-smokesignal-image-4 Avatar must have 1:1 aspect ratio: got {width}:{height}")] InvalidAvatarAspectRatio { /// The width of the image in pixels. width: u32, /// The height of the image in pixels. height: u32, },
/// Error when encoding an avatar as PNG fails. /// /// This error occurs when the PNG encoding process fails after resizing /// and processing the avatar image. #[error("error-smokesignal-image-5 Failed to encode avatar as PNG: {0}")] AvatarEncodeFailed(String),
/// Error when loading a banner image fails. /// /// This error occurs when attempting to load image data for banner /// processing, typically due to invalid format or corrupted data. #[error("error-smokesignal-image-6 Failed to load banner image: {0}")] BannerLoadFailed(String),
/// Error when banner aspect ratio is not 16:9. /// /// This error occurs when a banner image doesn't have the required /// 16:9 aspect ratio (allowing 10% deviation). #[error("error-smokesignal-image-7 Banner must have 16:9 aspect ratio: got {width}:{height}")] InvalidBannerAspectRatio { /// The width of the image in pixels. width: u32, /// The height of the image in pixels. height: u32, },
/// Error when encoding a banner as PNG fails. /// /// This error occurs when the PNG encoding process fails after resizing /// and processing the banner image. #[error("error-smokesignal-image-8 Failed to encode banner as PNG: {0}")] BannerEncodeFailed(String),
/// Error when loading an event header image fails. /// /// This error occurs when attempting to load image data for event header /// processing, typically due to invalid format or corrupted data. #[error("error-smokesignal-image-9 Failed to load event header image: {0}")] EventHeaderLoadFailed(String),
/// Error when event header aspect ratio is not 16:9. /// /// This error occurs when an event header image doesn't have the required /// 16:9 aspect ratio (allowing 10% deviation). #[error("error-smokesignal-image-10 Event header must have 16:9 aspect ratio: got {width}:{height}")] InvalidEventHeaderAspectRatio { /// The width of the image in pixels. width: u32, /// The height of the image in pixels. height: u32, },
/// Error when encoding an event header as PNG fails. /// /// This error occurs when the PNG encoding process fails after resizing /// and processing the event header image. #[error("error-smokesignal-image-11 Failed to encode event header as PNG: {0}")] EventHeaderEncodeFailed(String),}