libimagentryutil: Move from error-chain to failure
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
This commit is contained in:
parent
e553d20a8f
commit
f3e7f677b0
4 changed files with 10 additions and 42 deletions
|
@ -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" }
|
||||
|
|
|
@ -1,32 +0,0 @@
|
|||
//
|
||||
// imag - the personal information management suite for the commandline
|
||||
// Copyright (C) 2015-2018 Matthias Beyer <mail@beyermatthias.de> 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 {
|
||||
}
|
||||
}
|
||||
|
|
@ -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<T: IsKindHeaderPathProvider>(&self) -> Result<bool> {
|
||||
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<T: IsKindHeaderPathProvider>(&mut self) -> Result<()> {
|
||||
self.get_header_mut()
|
||||
.insert(T::kindflag_header_location(), Value::Boolean(true))
|
||||
.map_err(EUE::from)
|
||||
.map_err(Error::from)
|
||||
.map(|_| ())
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue