diff --git a/lib/entry/libimagentryutil/Cargo.toml b/lib/entry/libimagentryutil/Cargo.toml index 16774334..c8d6da20 100644 --- a/lib/entry/libimagentryutil/Cargo.toml +++ b/lib/entry/libimagentryutil/Cargo.toml @@ -21,9 +21,9 @@ maintenance = { status = "actively-developed" } [dependencies] toml = "0.4" -toml-query = "0.7" -error-chain = "0.12" +toml-query = { git = "https://github.com/matthiasbeyer/toml-query", branch = "failure" } filters = "0.3" +failure = "0.1" libimagstore = { version = "0.9.0", path = "../../../lib/core/libimagstore" } libimagerror = { version = "0.9.0", path = "../../../lib/core/libimagerror" } diff --git a/lib/entry/libimagentryutil/src/error.rs b/lib/entry/libimagentryutil/src/error.rs deleted file mode 100644 index 87b48a40..00000000 --- a/lib/entry/libimagentryutil/src/error.rs +++ /dev/null @@ -1,32 +0,0 @@ -// -// imag - the personal information management suite for the commandline -// Copyright (C) 2015-2018 Matthias Beyer and contributors -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; version -// 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -// - -error_chain! { - types { - EntryUtilError, EntryUtilErrorKind, ResultExt, Result; - } - - foreign_links { - TomlQueryError(::toml_query::error::Error); - } - - errors { - } -} - diff --git a/lib/entry/libimagentryutil/src/isa.rs b/lib/entry/libimagentryutil/src/isa.rs index 0681a75f..1481da51 100644 --- a/lib/entry/libimagentryutil/src/isa.rs +++ b/lib/entry/libimagentryutil/src/isa.rs @@ -17,8 +17,8 @@ // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // -use error::EntryUtilError as EUE; -use error::Result; +use failure::Fallible as Result; +use failure::Error; use toml::Value; use toml_query::read::TomlValueReadTypeExt; @@ -41,8 +41,9 @@ use toml_query::insert::TomlValueInsertExt; /// # extern crate libimagstore; /// # #[macro_use] /// # extern crate libimagentryutil; +/// # extern crate failure; /// -/// # use libimagentryutil::error::Result as Result; +/// use failure::Fallible as Result; /// use libimagentryutil::isa::IsKindHeaderPathProvider; /// use libimagentryutil::isa::Is; /// @@ -76,16 +77,16 @@ impl Is for ::libimagstore::store::Entry { fn is(&self) -> Result { let field = T::kindflag_header_location(); - match self.get_header().read_bool(field)? { + match self.get_header().read_bool(field).map_err(Error::from)? { Some(b) => Ok(b), - None => Err(format!("Field {} not available", field)).map_err(EUE::from), + None => Err(format_err!("Field {} not available", field)), } } fn set_isflag(&mut self) -> Result<()> { self.get_header_mut() .insert(T::kindflag_header_location(), Value::Boolean(true)) - .map_err(EUE::from) + .map_err(Error::from) .map(|_| ()) } } diff --git a/lib/entry/libimagentryutil/src/lib.rs b/lib/entry/libimagentryutil/src/lib.rs index 544d1770..f484d829 100644 --- a/lib/entry/libimagentryutil/src/lib.rs +++ b/lib/entry/libimagentryutil/src/lib.rs @@ -38,12 +38,11 @@ extern crate filters; extern crate toml; extern crate toml_query; -#[macro_use] extern crate error_chain; +#[macro_use] extern crate failure; extern crate libimagstore; extern crate libimagerror; -pub mod error; pub mod isa; pub mod isincollection; pub mod iter;