diff options
author | Matthias Beyer <mail@beyermatthias.de> | 2019-05-18 00:14:34 +0200 |
---|---|---|
committer | Matthias Beyer <mail@beyermatthias.de> | 2019-05-18 00:55:10 +0200 |
commit | c02b2f88decd961b846692db949ad0b86bb84cd5 (patch) | |
tree | 129c7a856ae17c1a7ec65618dd899b5245c373ba /lib/entry/libimagentrylink/src/external.rs | |
parent | c7ea58eda2c90800804554e431a375b08da409c5 (diff) |
Add more context in error messages
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
Diffstat (limited to 'lib/entry/libimagentrylink/src/external.rs')
-rw-r--r-- | lib/entry/libimagentrylink/src/external.rs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/entry/libimagentrylink/src/external.rs b/lib/entry/libimagentrylink/src/external.rs index 3151ebe2..a31871d8 100644 --- a/lib/entry/libimagentrylink/src/external.rs +++ b/lib/entry/libimagentrylink/src/external.rs @@ -70,7 +70,7 @@ impl Link for Entry { fn get_link_uri_from_filelockentry(&self) -> Result<Option<Url>> { self.get_header() .read_string("links.external.content.url") - .map_err(Error::from) + .context(format_err!("Error reading header 'links.external.content.url' from '{}'", self.get_location())) .context(EM::EntryHeaderReadError) .map_err(Error::from) .and_then(|opt| match opt { @@ -79,11 +79,13 @@ impl Link for Entry { debug!("Found url, parsing: {:?}", s); Url::parse(&s[..]) .map_err(Error::from) + .context(format_err!("Failed to parse URL: '{}'", s)) .context(err_msg("Invalid URI")) .map_err(Error::from) .map(Some) }, }) + .context("Failed to get link URI from entry") .map_err(Error::from) } @@ -91,6 +93,7 @@ impl Link for Entry { match self.get_header().read_string("links.external.url")? { None => Ok(None), Some(ref s) => Url::parse(&s[..]) + .context(format_err!("Failed to parse URL: '{}'", s)) .map(Some) .map_err(Error::from) .context(EM::EntryHeaderReadError) |