radicle_git_ext/
error.rs

1use std::{fmt::Display, io};
2
3pub fn is_not_found_err(e: &git2::Error) -> bool {
4    e.code() == git2::ErrorCode::NotFound
5}
6
7pub fn is_exists_err(e: &git2::Error) -> bool {
8    e.code() == git2::ErrorCode::Exists
9}
10
11pub fn into_git_err<E: Display>(e: E) -> git2::Error {
12    git2::Error::from_str(&e.to_string())
13}
14
15pub fn into_io_err(e: git2::Error) -> io::Error {
16    io::Error::other(e)
17}