gitcc_core/
error.rs

1//! Error
2
3/// Core error
4#[derive(Debug, thiserror::Error)]
5#[error("{0}")]
6pub struct Error(String);
7
8impl Error {
9    /// Creates an [Error] from a string
10    pub fn msg(msg: &str) -> Self {
11        Self(msg.to_string())
12    }
13}
14
15impl From<std::io::Error> for Error {
16    fn from(value: std::io::Error) -> Self {
17        Error::msg(&value.to_string())
18    }
19}
20
21impl From<toml::de::Error> for Error {
22    fn from(value: toml::de::Error) -> Self {
23        Error::msg(&value.to_string())
24    }
25}
26
27impl From<toml::ser::Error> for Error {
28    fn from(value: toml::ser::Error) -> Self {
29        Error::msg(&value.to_string())
30    }
31}
32
33impl From<serde_yaml::Error> for Error {
34    fn from(value: serde_yaml::Error) -> Self {
35        Error::msg(&value.to_string())
36    }
37}
38
39impl From<gitcc_git::Error> for Error {
40    fn from(value: gitcc_git::Error) -> Self {
41        Error::msg(&value.to_string())
42    }
43}
44
45impl From<gitcc_convco::ConvcoError> for Error {
46    fn from(value: gitcc_convco::ConvcoError) -> Self {
47        Error::msg(&value.to_string())
48    }
49}