aboutsummaryrefslogtreecommitdiffstats
path: root/src/git.rs
diff options
context:
space:
mode:
authorTeddy Wing2021-05-30 16:06:41 +0200
committerTeddy Wing2021-05-30 16:06:41 +0200
commitd071c5e456367ed0cc4f907e9e5c7dc46c331399 (patch)
tree9e8d72f87baf39f59d9e148da99b07f1cda84973 /src/git.rs
parent7d61e57aa6a7f3e61eb4ceac2b6fd7104245c3fe (diff)
downloadreflectub-d071c5e456367ed0cc4f907e9e5c7dc46c331399.tar.bz2
Replace boxed errors with concrete error types
Diffstat (limited to 'src/git.rs')
-rw-r--r--src/git.rs13
1 files changed, 11 insertions, 2 deletions
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<P: AsRef<Path>>(
url: &str,
path: P,
description: Option<&str>,
-) -> Result<(), Box<dyn std::error::Error>> {
+) -> Result<(), Error> {
let mut repo_init_options = git2::RepositoryInitOptions::new();
repo_init_options.bare(true);
@@ -51,7 +60,7 @@ pub fn mirror<P: AsRef<Path>>(
/// ```
pub fn update<P: AsRef<Path>>(
path: P,
-) -> Result<(), Box<dyn std::error::Error>> {
+) -> Result<(), Error> {
let repo = git2::Repository::open_bare(path)?;
for remote_opt in &repo.remotes()? {