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 06e78c75de
commit 740729bfda

View file

@ -27,6 +27,7 @@ use libimagentrylink::internal::InternalLinker;
use failure::Fallible as Result;
use failure::Error;
use failure::err_msg;
use failure::ResultExt;
pub struct Wiki<'a, 'b>(&'a Store, &'b str);
@ -58,6 +59,7 @@ impl<'a, 'b> Wiki<'a, 'b> {
self.0
.get(sid)
.context("Cannot get ID from store")
.map_err(Error::from)?
.ok_or_else(|| Error::from(err_msg("Missing index")))
}