diff options
Diffstat (limited to 'bin/domain/imag-log/src')
-rw-r--r-- | bin/domain/imag-log/src/lib.rs | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/bin/domain/imag-log/src/lib.rs b/bin/domain/imag-log/src/lib.rs index 28e02bdc..8440fbd8 100644 --- a/bin/domain/imag-log/src/lib.rs +++ b/bin/domain/imag-log/src/lib.rs @@ -40,7 +40,7 @@ extern crate clap; extern crate toml; extern crate toml_query; extern crate itertools; -extern crate failure; +#[macro_use] extern crate anyhow; extern crate textwrap; extern crate resiter; @@ -54,9 +54,9 @@ use std::io::Write; use std::io::Cursor; use std::str::FromStr; -use failure::Error; -use failure::err_msg; -use failure::Fallible as Result; +use anyhow::Error; + +use anyhow::Result; use resiter::Map; use resiter::AndThen; use resiter::IterInnerOkOrElse; @@ -92,7 +92,7 @@ impl ImagApplication for ImagLog { if rt.handle_unknown_subcommand("imag-bookmark", other, rt.cli())?.success() { Ok(()) } else { - Err(err_msg("Failed to handle unknown subcommand")) + Err(anyhow!("Failed to handle unknown subcommand")) } }, } @@ -186,7 +186,7 @@ fn show(rt: &Runtime) -> Result<()> { let v = iters.into_iter() .flatten() .into_get_iter(rt.store()) - .map_inner_ok_or_else(|| err_msg("Did not find one entry")) + .map_inner_ok_or_else(|| anyhow!("Did not find one entry")) .and_then_ok(|e| e.is_log().map(|b| (b, e))) .filter_ok(|tpl| tpl.0) .map_ok(|tpl| tpl.1) @@ -228,20 +228,20 @@ fn get_diary_name(rt: &Runtime) -> Result<String> { let cfg = rt .config() - .ok_or_else(|| err_msg("Configuration not present, cannot continue"))?; + .ok_or_else(|| anyhow!("Configuration not present, cannot continue"))?; let current_log = cfg .read_string("log.default")? - .ok_or_else(|| err_msg("Configuration missing: 'log.default'"))?; + .ok_or_else(|| anyhow!("Configuration missing: 'log.default'"))?; if cfg .read("log.logs")? - .ok_or_else(|| err_msg("Configuration missing: 'log.logs'"))? + .ok_or_else(|| anyhow!("Configuration missing: 'log.logs'"))? .as_array() - .ok_or_else(|| err_msg("Configuration 'log.logs' is not an Array"))? + .ok_or_else(|| anyhow!("Configuration 'log.logs' is not an Array"))? .iter() .map(|e| if !is_match!(e, &Value::String(_)) { - Err(err_msg("Configuration 'log.logs' is not an Array<String>!")) + Err(anyhow!("Configuration 'log.logs' is not an Array<String>!")) } else { Ok(e) }) @@ -252,7 +252,7 @@ fn get_diary_name(rt: &Runtime) -> Result<String> { .find(|log| *log == ¤t_log) .is_none() { - Err(err_msg("'log.logs' does not contain 'log.default'")) + Err(anyhow!("'log.logs' does not contain 'log.default'")) } else { Ok(current_log) } |