Add more context in error messages
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
This commit is contained in:
parent
f44e10e295
commit
d8bcb8ca8e
2 changed files with 5 additions and 1 deletions
|
@ -23,6 +23,7 @@ use toml_query::read::TomlValueReadExt;
|
|||
use filters::failable::filter::FailableFilter;
|
||||
|
||||
use failure::Fallible as Result;
|
||||
use failure::ResultExt;
|
||||
use failure::Error;
|
||||
|
||||
use crate::builtin::header::field_path::FieldPath;
|
||||
|
@ -47,6 +48,9 @@ impl FailableFilter<Entry> for FieldExists {
|
|||
fn filter(&self, e: &Entry) -> Result<bool> {
|
||||
e.get_header()
|
||||
.read(&self.header_field_path[..])
|
||||
.context(format_err!("Failed reading header '{}' in '{}'",
|
||||
self.header_field_path,
|
||||
e.get_location()))
|
||||
.map_err(Error::from)
|
||||
.map(|o| o.is_some())
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ extern crate regex;
|
|||
extern crate semver;
|
||||
extern crate toml;
|
||||
extern crate toml_query;
|
||||
extern crate failure;
|
||||
#[macro_use] extern crate failure;
|
||||
|
||||
extern crate libimagstore;
|
||||
extern crate libimagentrytag;
|
||||
|
|
Loading…
Reference in a new issue