diff options
author | Matthias Beyer <mail@beyermatthias.de> | 2018-10-30 18:40:53 +0100 |
---|---|---|
committer | Matthias Beyer <mail@beyermatthias.de> | 2018-10-30 18:46:29 +0100 |
commit | d7eda6c451db81225d091c5513600fd6004d0643 (patch) | |
tree | ca5a29f1b66b8ae72eaab9a423d066ffc9cc41a7 /bin/domain/imag-log/src | |
parent | 62eb711409773cd2675af67c91c561a759da1acd (diff) |
imag-log: Move from error-chain to failure
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
Diffstat (limited to 'bin/domain/imag-log/src')
-rw-r--r-- | bin/domain/imag-log/src/main.rs | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/bin/domain/imag-log/src/main.rs b/bin/domain/imag-log/src/main.rs index 053f06e5..56d50189 100644 --- a/bin/domain/imag-log/src/main.rs +++ b/bin/domain/imag-log/src/main.rs @@ -38,6 +38,7 @@ extern crate clap; extern crate toml; extern crate toml_query; extern crate itertools; +extern crate failure; extern crate libimaglog; #[macro_use] extern crate libimagrt; @@ -47,6 +48,9 @@ extern crate libimagdiary; use std::io::Write; +use failure::Error; +use failure::err_msg; + use libimagrt::runtime::Runtime; use libimagrt::setup::generate_runtime_setup; use libimagerror::trace::MapErrTrace; @@ -55,7 +59,6 @@ use libimagerror::exit::ExitUnwrap; use libimagerror::iter::TraceIterator; use libimagdiary::diary::Diary; use libimaglog::log::Log; -use libimaglog::error::LogError as LE; use libimagstore::iter::get::StoreIdGetIteratorExtension; mod ui; @@ -175,16 +178,17 @@ fn get_diary_name(rt: &Runtime) -> String { let cfg = rt .config() - .ok_or(LE::from("Configuration not present, cannot continue")) + .ok_or_else(|| Error::from(err_msg("Configuration not present, cannot continue"))) .map_err_trace_exit_unwrap(1); let logs = cfg .read("log.logs") + .map_err(Error::from) .map_err_trace_exit_unwrap(1) - .ok_or(LE::from("Configuration missing: 'log.logs'")) + .ok_or_else(|| Error::from(err_msg("Configuration missing: 'log.logs'"))) .map_err_trace_exit_unwrap(1) .as_array() - .ok_or(LE::from("Configuration 'log.logs' is not an Array")) + .ok_or_else(|| Error::from(err_msg("Configuration 'log.logs' is not an Array"))) .map_err_trace_exit_unwrap(1); if !logs.iter().all(|e| is_match!(e, &Value::String(_))) { @@ -201,8 +205,9 @@ fn get_diary_name(rt: &Runtime) -> String { let current_log = cfg .read_string("log.default") + .map_err(Error::from) .map_err_trace_exit_unwrap(1) - .ok_or(LE::from("Configuration missing: 'log.default'")) + .ok_or_else(|| Error::from(err_msg("Configuration missing: 'log.default'"))) .map_err_trace_exit_unwrap(1); if !logs.contains(¤t_log) { |