Minify Runtime::new() by refactoring error tracing
This commit is contained in:
parent
07ff755ed7
commit
15dcb26fd2
1 changed files with 2 additions and 9 deletions
|
@ -4,7 +4,7 @@ use git2::{Index, Repository};
|
||||||
use toml::Value;
|
use toml::Value;
|
||||||
|
|
||||||
use libimagerror::into::IntoError;
|
use libimagerror::into::IntoError;
|
||||||
use libimagerror::trace::trace_error;
|
use libimagerror::trace::{MapErrTrace, trace_error};
|
||||||
use libimagstore::hook::error::CustomData;
|
use libimagstore::hook::error::CustomData;
|
||||||
use libimagstore::hook::error::HookErrorKind as HEK;
|
use libimagstore::hook::error::HookErrorKind as HEK;
|
||||||
use libimagstore::hook::result::HookResult;
|
use libimagstore::hook::result::HookResult;
|
||||||
|
@ -31,14 +31,7 @@ impl Runtime {
|
||||||
/// returns a `Runtime` object that does _not_ contain a `Repository`.
|
/// returns a `Runtime` object that does _not_ contain a `Repository`.
|
||||||
pub fn new(storepath: &PathBuf) -> Runtime {
|
pub fn new(storepath: &PathBuf) -> Runtime {
|
||||||
Runtime {
|
Runtime {
|
||||||
repository: match Repository::open(storepath) {
|
repository: Repository::open(storepath).map_err_trace().ok(),
|
||||||
Ok(r) => Some(r),
|
|
||||||
Err(e) => {
|
|
||||||
trace_error(&e);
|
|
||||||
None
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
config: None,
|
config: None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue