diff --git a/lib/entry/libimagentryutil/src/isa.rs b/lib/entry/libimagentryutil/src/isa.rs index f10152b8..7730eea2 100644 --- a/lib/entry/libimagentryutil/src/isa.rs +++ b/lib/entry/libimagentryutil/src/isa.rs @@ -18,6 +18,7 @@ // use failure::Fallible as Result; +use failure::ResultExt; use failure::Error; use toml::Value; @@ -79,7 +80,12 @@ impl Is for ::libimagstore::store::Entry { fn is(&self) -> Result { let field = T::kindflag_header_location(); - match self.get_header().read_bool(field).map_err(Error::from)? { + match self + .get_header() + .read_bool(field) + .context(format_err!("Failed reading header '{}' in '{}'", field, self.get_location())) + .map_err(Error::from)? + { Some(b) => Ok(b), None => Ok(false), } @@ -88,6 +94,7 @@ impl Is for ::libimagstore::store::Entry { fn set_isflag(&mut self) -> Result<()> { self.get_header_mut() .insert(T::kindflag_header_location(), Value::Boolean(true)) + .context(format_err!("Failed inserting header '{}' in '{}'", T::kindflag_header_location(), self.get_location())) .map_err(Error::from) .map(|_| ()) } @@ -96,6 +103,7 @@ impl Is for ::libimagstore::store::Entry { trace!("Trying to remove: {}", T::kindflag_header_location()); self.get_header_mut() .delete(T::kindflag_header_location()) + .context(format_err!("Failed deleting header '{}' in '{}'", T::kindflag_header_location(), self.get_location())) .map_err(Error::from) .map(|_| ()) } diff --git a/lib/entry/libimagentryutil/src/lib.rs b/lib/entry/libimagentryutil/src/lib.rs index 6dbc1870..c5feb7cb 100644 --- a/lib/entry/libimagentryutil/src/lib.rs +++ b/lib/entry/libimagentryutil/src/lib.rs @@ -40,7 +40,7 @@ extern crate filters; extern crate toml; extern crate toml_query; -extern crate failure; +#[macro_use] extern crate failure; #[macro_use] extern crate log; extern crate libimagstore;