From 6d8bac314cfe7d1a1fc14ee7dd0d147ce8fca84a Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Tue, 30 Oct 2018 18:40:52 +0100 Subject: [PATCH] imag-tag: Move from error-chain to failure Signed-off-by: Matthias Beyer --- bin/core/imag-tag/Cargo.toml | 3 ++- bin/core/imag-tag/src/main.rs | 14 ++++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/bin/core/imag-tag/Cargo.toml b/bin/core/imag-tag/Cargo.toml index fb30659e..e591586f 100644 --- a/bin/core/imag-tag/Cargo.toml +++ b/bin/core/imag-tag/Cargo.toml @@ -37,8 +37,9 @@ default-features = false features = ["color", "suggestions", "wrap_help"] [dev-dependencies] -toml-query = "0.7" +toml-query = { git = "https://github.com/matthiasbeyer/toml-query", branch = "failure" } env_logger = "0.5" +failure = "0.1" [dev-dependencies.libimagutil] version = "0.9.0" diff --git a/bin/core/imag-tag/src/main.rs b/bin/core/imag-tag/src/main.rs index 01387336..25fb6707 100644 --- a/bin/core/imag-tag/src/main.rs +++ b/bin/core/imag-tag/src/main.rs @@ -36,6 +36,7 @@ extern crate clap; #[macro_use] extern crate log; #[cfg(test)] extern crate toml; +#[cfg(test)] extern crate failure; extern crate libimagstore; #[macro_use] extern crate libimagrt; @@ -80,7 +81,7 @@ fn main() { let version = make_imag_version!(); let rt = generate_runtime_setup("imag-tag", &version, - "Add and remove tags for entries", + "Direct interface to the store. Use with great care!", build_ui); let ids : Vec = rt @@ -269,11 +270,12 @@ mod tests { use toml::value::Value; use toml_query::read::TomlValueReadExt; - use toml_query::error::Result as TomlQueryResult; + use failure::Fallible as Result; + use failure::Error; use libimagrt::runtime::Runtime; use libimagstore::storeid::StoreId; - use libimagstore::store::{Result as StoreResult, FileLockEntry, Entry}; + use libimagstore::store::{FileLockEntry, Entry}; use super::*; @@ -285,7 +287,7 @@ mod tests { } use self::mock::generate_test_runtime; - fn create_test_default_entry<'a, S: AsRef>(rt: &'a Runtime, name: S) -> StoreResult { + fn create_test_default_entry<'a, S: AsRef>(rt: &'a Runtime, name: S) -> Result { let mut path = PathBuf::new(); path.set_file_name(name); @@ -300,8 +302,8 @@ mod tests { Ok(id) } - fn get_entry_tags<'a>(entry: &'a FileLockEntry<'a>) -> TomlQueryResult> { - entry.get_header().read(&"tag.values".to_owned()) + fn get_entry_tags<'a>(entry: &'a FileLockEntry<'a>) -> Result> { + entry.get_header().read(&"tag.values".to_owned()).map_err(Error::from) } fn tags_toml_value<'a, I: IntoIterator>(tags: I) -> Value {