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
//! Error

/// Core error
#[derive(Debug, thiserror::Error)]
#[error("{0}")]
pub struct Error(String);

impl Error {
    /// Creates an [Error] from a string
    pub fn msg(msg: &str) -> Self {
        Self(msg.to_string())
    }
}

impl From<std::io::Error> for Error {
    fn from(value: std::io::Error) -> Self {
        Error::msg(&value.to_string())
    }
}

impl From<toml::de::Error> for Error {
    fn from(value: toml::de::Error) -> Self {
        Error::msg(&value.to_string())
    }
}

impl From<toml::ser::Error> for Error {
    fn from(value: toml::ser::Error) -> Self {
        Error::msg(&value.to_string())
    }
}

impl From<gitcc_git::Error> for Error {
    fn from(value: gitcc_git::Error) -> Self {
        Error::msg(&value.to_string())
    }
}

impl From<gitcc_convco::ConvcoError> for Error {
    fn from(value: gitcc_convco::ConvcoError) -> Self {
        Error::msg(&value.to_string())
    }
}