1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
//! Git error

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

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

impl From<git2::Error> for Error {
    fn from(value: git2::Error) -> Self {
        Error(value.message().to_string())
    }
}