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
54
55
56
57
58
59
60
61
use crate::prelude::*;
use std::{ffi::OsString, io};
use thiserror::Error;
pub type Result<T> = anyhow::Result<T, anyhow::Error>;
#[non_exhaustive]
#[derive(Debug, Error)]
pub enum Error {
#[error("invalid texture id `{0}`")]
InvalidTexture(TextureId),
#[error("invalid window id `{0}`")]
InvalidWindow(WindowId),
#[error("hexadecimal color string parsing error")]
ParseColorError,
#[error("invalid color slice")]
InvalidColorSlice,
#[error(
"invalid image {{ width: {width}, height: {height}, size: {size}, format: {format:?} }}"
)]
InvalidImage {
width: u32,
height: u32,
size: usize,
format: PixelFormat,
},
#[error("unsupported image format {{ bit_depth: {bit_depth:?}, color_type: {color_type:?} }}")]
UnsupportedImageFormat {
bit_depth: png::BitDepth,
color_type: png::ColorType,
},
#[error("unsupported file type with extension `{0:?}`")]
UnsupportedFileType(Option<OsString>),
#[error("renderer error: {0}")]
Renderer(String),
#[error(transparent)]
Io(#[from] io::Error),
#[error(transparent)]
Other(#[from] anyhow::Error),
}