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 let head = try!(self
.repository() .repository()
.and_then(|r| { .and_then(|r| {
r.head().map_err_into(GHEK::HeadFetchError) r.head().map_err_into(GHEK::HeadFetchError).map_err(|e| e.into())
}) }));
.map_err(Box::new)
.map_err(|e| HEK::HookExecutionError.into_error_with_cause(e)));
// TODO: Fail if not on branch? hmmh... I'm not sure // TODO: Fail if not on branch? hmmh... I'm not sure
if head.is_branch() { if head.is_branch() {
return Err(GHEK::NotOnBranch.into_error()) return Err(GHEK::NotOnBranch.into_error().into());
.map_err(Box::new)
.map_err(|e| HEK::HookExecutionError.into_error_with_cause(e));
} }
// Check out appropriate branch ... or fail // Check out appropriate branch ... or fail