From d071c5e456367ed0cc4f907e9e5c7dc46c331399 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Sun, 30 May 2021 16:06:41 +0200 Subject: Replace boxed errors with concrete error types --- src/git.rs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src/git.rs') diff --git a/src/git.rs b/src/git.rs index d83d2b6..7ad919f 100644 --- a/src/git.rs +++ b/src/git.rs @@ -1,6 +1,15 @@ +use thiserror; + use std::path::Path; +#[derive(Debug, thiserror::Error)] +pub enum Error { + #[error("git error")] + Git(#[from] git2::Error), +} + + /// Mirror a repository. /// /// Works like: @@ -12,7 +21,7 @@ pub fn mirror>( url: &str, path: P, description: Option<&str>, -) -> Result<(), Box> { +) -> Result<(), Error> { let mut repo_init_options = git2::RepositoryInitOptions::new(); repo_init_options.bare(true); @@ -51,7 +60,7 @@ pub fn mirror>( /// ``` pub fn update>( path: P, -) -> Result<(), Box> { +) -> Result<(), Error> { let repo = git2::Repository::open_bare(path)?; for remote_opt in &repo.remotes()? { -- cgit v1.2.3