diff options
Diffstat (limited to 'lib/core/libimagrt/src/configuration.rs')
-rw-r--r-- | lib/core/libimagrt/src/configuration.rs | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/lib/core/libimagrt/src/configuration.rs b/lib/core/libimagrt/src/configuration.rs index 000c20ba..7de02eb3 100644 --- a/lib/core/libimagrt/src/configuration.rs +++ b/lib/core/libimagrt/src/configuration.rs @@ -21,12 +21,12 @@ use std::path::PathBuf; use toml::Value; use clap::App; -use failure::ResultExt; -use failure::Fallible as Result; -use failure::Error; -use failure::err_msg; +use anyhow::Context; +use anyhow::Result; +use anyhow::Error; -use libimagerror::errors::ErrorMsg as EM; + +use libimagerror::errors::Error as EM; /// Get a new configuration object. /// @@ -119,18 +119,17 @@ pub fn override_config(val: &mut Value, v: Vec<String>) -> Result<()> { None })) .map(|(k, v)| { - let value = val.read_mut(&k) - .context(EM::TomlQueryError)? - .ok_or_else(|| err_msg("No config value there, cannot override."))?; + let value = val.read_mut(&k)? + .ok_or_else(|| anyhow!("No config value there, cannot override."))?; let new_value = into_value(value, v) - .ok_or_else(|| err_msg("Config override type not matching"))?; + .ok_or_else(|| anyhow!("Config override type not matching"))?; info!("Successfully overridden: {} = {}", k, new_value); *value = new_value; Ok(()) }) - .map(|elem: Result<()>| elem.context(err_msg("Config override error")).map_err(Error::from)) + .map(|elem: Result<()>| elem.context(anyhow!("Config override error")).map_err(Error::from)) .collect::<Result<()>>() } |