From e5a066ed0b97abdf8467fb9a0be42b595b35c222 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Wed, 27 Jul 2016 13:10:54 +0200 Subject: [PATCH] Add error kind and impl From for HE --- libimagstorestdhook/src/vcs/git/error.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/libimagstorestdhook/src/vcs/git/error.rs b/libimagstorestdhook/src/vcs/git/error.rs index 0af7b0ab..f7ce2cb6 100644 --- a/libimagstorestdhook/src/vcs/git/error.rs +++ b/libimagstorestdhook/src/vcs/git/error.rs @@ -1,3 +1,5 @@ +use git2::Error as Git2Error; + use libimagstore::hook::error::HookError as HE; use libimagstore::hook::error::HookErrorKind as HEK; use libimagstore::hook::result::HookResult; @@ -8,6 +10,7 @@ generate_error_module!( NoConfigError => "No Configuration", ConfigTypeError => "Configuration value type wrong", RuntimeInformationSetupError => "Couldn't setup runtime information for git hook", + RepositoryBackendError => "Error in the git library", RepositoryError => "Error while interacting with git repository", RepositoryBranchError => "Error while interacting with git branch(es)", RepositoryBranchNameFetchingError => "Error while fetching branch name", @@ -41,6 +44,14 @@ impl From for HE { } +impl From for GitHookError { + + fn from(ge: Git2Error) -> GitHookError { + GitHookError::new(GitHookErrorKind::RepositoryBackendError, Some(Box::new(ge))) + } + +} + pub use self::error::GitHookError; pub use self::error::GitHookErrorKind; pub use self::error::MapErrInto;