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
use std::{io, string::FromUtf16Error, string::FromUtf8Error};
use thiserror::Error;

#[derive(Debug, Error)]
#[non_exhaustive]
pub enum Error {
    #[error("I/O Error: {0}")]
    IOError(#[from] io::Error),

    #[error("Invalid UTF-8: {0}")]
    InvalidUtf8_8(#[from] FromUtf8Error),

    #[error("Invalid UTF-8: {0}")]
    InvalidUtf8_16(#[from] FromUtf16Error),

    #[error("Invalid INI: {0}")]
    InvalidIni(#[from] ini::ini::Error),

    #[error("Enquote error: {0}")]
    Enquote(#[from] enquote::Error),

    #[error("{command} exited with status code {code}")]
    CommandFailed { command: String, code: i32 },

    #[error("Could not find config directory")]
    NoConfigDir,

    #[error("No {0} image found")]
    NoImage(&'static str),

    #[cfg(all(unix, not(target_os = "macos")))]
    #[error("{0}")]
    XfceNoDesktops(#[from] crate::linux::xfce::NoDesktopsError),

    #[error("Unsupported Desktop")]
    UnsupportedDesktop,
}