Skip to main content

busybar_render/
error.rs

1use crate::encoding::ImageFormat;
2use crate::raw::PixelLayout;
3
4#[derive(Debug, thiserror::Error)]
5pub enum RenderError {
6    #[error("{width}x{height} in {layout} needs {expected} bytes, but {actual} were given")]
7    UnexpectedSize {
8        width: u32,
9        height: u32,
10        layout: PixelLayout,
11        expected: usize,
12        actual: usize,
13    },
14
15    #[error("a {width}x{height} image does not fit a raster of {pixel} with a {gap} gap")]
16    RasterTooLarge {
17        width: u32,
18        height: u32,
19        pixel: u32,
20        gap: u32,
21    },
22
23    #[error("could not encode a {width}x{height} image as {format}")]
24    Encode {
25        width: u32,
26        height: u32,
27        format: ImageFormat,
28        #[source]
29        source: image::ImageError,
30    },
31}