1#[derive(Debug, thiserror::Error)]
2pub enum Errors {
3 #[error("Could not detect font size")]
4 NoFontSize,
5 #[error("Could not detect any graphics nor font capabilities")]
6 NoCap,
7 #[error("No response from stdin")]
8 NoStdinResponse,
9 #[error("Sixel error: {0}")]
10 Sixel(String),
11 #[error("Tmux error: {0}")]
12 Tmux(&'static str),
13 #[error("Io error: {0}")]
14 Io(#[from] std::io::Error),
15 #[error("Image error: {0}")]
16 Image(#[from] image::error::ImageError),
17}
18
19#[cfg(not(windows))]
20impl From<rustix::io::Errno> for Errors {
21 fn from(errno: rustix::io::Errno) -> Self {
22 Errors::Io(std::io::Error::from(errno))
23 }
24}
25
26#[cfg(windows)]
27impl From<windows::core::Error> for Errors {
28 fn from(err: windows::core::Error) -> Self {
29 Errors::Io(std::io::Error::new(
30 std::io::ErrorKind::Other,
31 err.to_string(),
32 ))
33 }
34}