1use std::fmt;
2
3#[derive(Debug)]
9pub enum Error {
10 AlreadyExists,
11 ConfigParse(String),
12 NotFound,
13 ConfigLoad(ini::Error),
14 ConfigCreation(std::io::Error),
15}
16
17impl fmt::Display for Error {
18 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
19 match self {
20 Error::AlreadyExists => write!(f, "The key already exists"),
21 Error::ConfigParse(e) => write!(f, "Failed to parse config: {e}"),
22 Error::NotFound => write!(f, "The key was not found"),
23 Error::ConfigLoad(e) => write!(f, "Failed to load config file: {e:?}"),
24 Error::ConfigCreation(e) => write!(f, "Failed to create config file: {e:?}"),
25 }
26 }
27}