Simplify error creating code snippet, as we have From<> now implemented

This commit is contained in:
Matthias Beyer 2016-07-27 13:17:30 +02:00
parent e5a066ed0b
commit 989c1790be

View file

@ -70,16 +70,12 @@ impl Runtime {
let head = try!(self
.repository()
.and_then(|r| {
r.head().map_err_into(GHEK::HeadFetchError)
})
.map_err(Box::new)
.map_err(|e| HEK::HookExecutionError.into_error_with_cause(e)));
r.head().map_err_into(GHEK::HeadFetchError).map_err(|e| e.into())
}));
// TODO: Fail if not on branch? hmmh... I'm not sure
if head.is_branch() {
return Err(GHEK::NotOnBranch.into_error())
.map_err(Box::new)
.map_err(|e| HEK::HookExecutionError.into_error_with_cause(e));
return Err(GHEK::NotOnBranch.into_error().into());
}
// Check out appropriate branch ... or fail