Add GitHookError::inside_if()

This commit is contained in:
Matthias Beyer 2016-07-21 17:54:44 +02:00
parent 189ebb2aea
commit 830d170518

View file

@ -1,3 +1,7 @@
use libimagstore::hook::error::HookError as HE;
use libimagstore::hook::error::HookErrorKind as HEK;
use libimagstore::hook::result::HookResult;
generate_error_module!( generate_error_module!(
generate_error_types!(GitHookError, GitHookErrorKind, generate_error_types!(GitHookError, GitHookErrorKind,
ConfigError => "Configuration Error", ConfigError => "Configuration Error",
@ -19,6 +23,14 @@ generate_error_module!(
); );
); );
impl GitHookError {
pub fn inside_of<T>(self, h: HEK) -> HookResult<T> {
Err(HE::new(h, Some(Box::new(self))))
}
}
pub use self::error::GitHookError; pub use self::error::GitHookError;
pub use self::error::GitHookErrorKind; pub use self::error::GitHookErrorKind;
pub use self::error::MapErrInto; pub use self::error::MapErrInto;