Add more context in error messages

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
This commit is contained in:
Matthias Beyer 2019-05-18 00:14:34 +02:00
parent 00fa3e7b78
commit 112a2d6af8
2 changed files with 4 additions and 0 deletions

View file

@ -34,6 +34,7 @@ pub fn config_implicit_store_create_allowed(config: &Option<Value>) -> Result<bo
if let Some(ref t) = *config {
t.read_bool(key)
.context(format_err!("Error reading header '{}' in configuration", key))
.map_err(Error::from)
.context(EM::TomlQueryError)?
.ok_or_else(|| format_err!("Config key missing: {}", key))

View file

@ -184,6 +184,9 @@ impl<'a> StoreIdWithBase<'a> {
store_part.display());
let p = full_path
.strip_prefix(store_part)
.context(format_err!("Cannot strip prefix '{}' from path: '{}'",
store_part.display(),
full_path.display()))
.map_err(Error::from)
.context(err_msg("Error building Store Id from full path"))?;
Ok(StoreIdWithBase(store_part, PathBuf::from(p)))