Files
radicle-git/radicle-git-ext/src/error.rs
T
Fintan Halpenny ce7dc3890a meta: use long crate names
To help with clarity and potential publishing of the crates, the full
`radicle-` prefix is used for the crate names.

Note that it wasn't chosen got `git-ref-format` and `git-trailers`
since they are truly general libraries (bar the feature flag for link
specific reference names).

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
2022-09-15 17:58:14 +01:00

23 lines
640 B
Rust

// Copyright © 2019-2020 The Radicle Foundation <hello@radicle.foundation>
//
// This file is part of radicle-link, distributed under the GPLv3 with Radicle
// Linking Exception. For full terms see the included LICENSE file.
use std::{fmt::Display, io};
pub fn is_not_found_err(e: &git2::Error) -> bool {
e.code() == git2::ErrorCode::NotFound
}
pub fn is_exists_err(e: &git2::Error) -> bool {
e.code() == git2::ErrorCode::Exists
}
pub fn into_git_err<E: Display>(e: E) -> git2::Error {
git2::Error::from_str(&e.to_string())
}
pub fn into_io_err(e: git2::Error) -> io::Error {
io::Error::new(io::ErrorKind::Other, e)
}