From 3321b9a643ebe1c926dbb7b44d393d714f2a2ebd Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Sat, 18 May 2019 00:14:34 +0200 Subject: [PATCH] Add more context in error messages Signed-off-by: Matthias Beyer --- lib/domain/libimaglog/src/log.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/domain/libimaglog/src/log.rs b/lib/domain/libimaglog/src/log.rs index 78901cda..5855e744 100644 --- a/lib/domain/libimaglog/src/log.rs +++ b/lib/domain/libimaglog/src/log.rs @@ -24,6 +24,7 @@ use libimagentryutil::isa::IsKindHeaderPathProvider; use failure::Fallible as Result; use failure::Error; +use failure::ResultExt; use toml::Value; @@ -38,12 +39,13 @@ provide_kindflag_path!(pub IsLog, "log.is_log"); impl Log for Entry { fn is_log(&self) -> Result { - self.is::().map_err(From::from) + self.is::().context("Cannot check whether Entry is a Log").map_err(From::from) } fn make_log_entry(&mut self) -> Result<()> { self.get_header_mut() .insert("log.is_log", Value::Boolean(true)) + .context("Cannot insert 'log.is_log' into header of entry") .map_err(Error::from) .map(|_| ()) }