summaryrefslogtreecommitdiffstats
path: root/lib/entry/libimagentryurl/src
diff options
context:
space:
mode:
Diffstat (limited to 'lib/entry/libimagentryurl/src')
-rw-r--r--lib/entry/libimagentryurl/src/iter.rs7
-rw-r--r--lib/entry/libimagentryurl/src/linker.rs8
2 files changed, 8 insertions, 7 deletions
diff --git a/lib/entry/libimagentryurl/src/iter.rs b/lib/entry/libimagentryurl/src/iter.rs
index 4a22a6b1..eb60e6bd 100644
--- a/lib/entry/libimagentryurl/src/iter.rs
+++ b/lib/entry/libimagentryurl/src/iter.rs
@@ -35,6 +35,8 @@ use libimagstore::store::Store;
use libimagutil::debug_result::DebugResult;
use failure::Fallible as Result;
+use failure::ResultExt;
+use failure::Error;
use url::Url;
/// Helper for building `OnlyUrlIter` and `NoUrlIter`
@@ -170,14 +172,15 @@ impl<'a> Iterator for UrlIter<'a> {
debug!("Retrieving entry for id: '{:?}'", id);
self.1
.retrieve(id.clone())
- .map_dbg_err(|_| format!("Retrieving entry for id: '{:?}' failed", id))
+ .with_context(|e| format!("Retrieving entry for id: '{:?}' failed: {}", id, e))
.map_err(From::from)
.and_then(|f| {
debug!("Store::retrieve({:?}) succeeded", id);
debug!("getting uri link from file now");
f.get_url()
.map_dbg_str("Error happened while getting link URI from FLE")
- .map_dbg_err(|e| format!("URL -> Err = {:?}", e))
+ .with_context(|e| format!("URL -> Err = {:?}", e))
+ .map_err(Error::from)
})
});
diff --git a/lib/entry/libimagentryurl/src/linker.rs b/lib/entry/libimagentryurl/src/linker.rs
index 175ffcea..b38463e3 100644
--- a/lib/entry/libimagentryurl/src/linker.rs
+++ b/lib/entry/libimagentryurl/src/linker.rs
@@ -20,10 +20,10 @@
use libimagstore::storeid::StoreId;
use libimagstore::store::Store;
use libimagstore::store::Entry;
-use libimagutil::debug_result::DebugResult;
use libimagentrylink::linkable::Linkable;
use failure::Fallible as Result;
+use failure::ResultExt;
use url::Url;
use sha1::{Sha1, Digest};
use hex;
@@ -93,7 +93,7 @@ impl UrlLinker for Entry {
links.into_iter().map(|link| {
let hash = hex::encode(Sha1::digest(&link.as_str().as_bytes()));
let file_id = crate::module_path::new_id(hash.clone())
- .map_dbg_err(|_| format!("Failed to build StoreId for this hash '{:?}'", hash))?;
+ .with_context(|e| format!("Failed to build StoreId for this hash '{:?}': {}", hash, e))?;
debug!("Link = '{:?}'", link);
debug!("Hash = '{:?}'", hash);
@@ -105,9 +105,7 @@ impl UrlLinker for Entry {
// exist
let mut file = store
.retrieve(file_id.clone())
- .map_dbg_err(|_| {
- format!("Failed to create or retrieve an file for this link '{:?}'", link)
- })?;
+ .with_context(|e| format!("Failed to create or retrieve an file for this link '{:?}': {}", link, e))?;
debug!("Generating header content!");
file.set_url(link)?;