summaryrefslogtreecommitdiffstats
path: root/lib/entry
diff options
context:
space:
mode:
Diffstat (limited to 'lib/entry')
-rw-r--r--lib/entry/libimagentrylink/src/storecheck.rs37
-rw-r--r--lib/entry/libimagentryurl/src/iter.rs10
-rw-r--r--lib/entry/libimagentryurl/src/linker.rs8
3 files changed, 22 insertions, 33 deletions
diff --git a/lib/entry/libimagentrylink/src/storecheck.rs b/lib/entry/libimagentrylink/src/storecheck.rs
index eab8eccf..f78d52cc 100644
--- a/lib/entry/libimagentrylink/src/storecheck.rs
+++ b/lib/entry/libimagentrylink/src/storecheck.rs
@@ -21,7 +21,6 @@ use std::collections::HashMap;
use libimagstore::store::Store;
use libimagstore::storeid::StoreId;
-use libimagutil::debug_result::DebugResult;
use failure::ResultExt;
use failure::Fallible as Result;
@@ -145,29 +144,19 @@ impl StoreLinkConsistentExt for Store {
Ok(())
};
- aggregate_link_network(&self)
- .map_dbg_str("Aggregated")
- .map_dbg(|nw| {
- let mut s = String::new();
- for (k, v) in nw {
- s.push_str(&format!("{}\n in: {:?}\n out: {:?}", k, v.incoming, v.outgoing));
- }
- s
- })
- .and_then(|nw| {
- all_collected_storeids_exist(&nw)
- .map(|_| nw)
- .context(err_msg("Link handling error"))
- .map_err(Error::from)
- })
- .and_then(|nw| {
- for (id, linking) in nw.iter() {
- incoming_links_exists_as_outgoing_links(id, linking, &nw)?;
- outgoing_links_exist_as_incoming_links(id, linking, &nw)?;
- }
- Ok(())
- })
- .map(|_| ())
+ let nw = aggregate_link_network(&self)?;
+
+ for (k, v) in nw.iter() {
+ debug!("{}\n in: {:?}\n out: {:?}", k, v.incoming, v.outgoing);
+ }
+
+ all_collected_storeids_exist(&nw).context("Link handling error")?;
+
+ for (id, linking) in nw.iter() {
+ incoming_links_exists_as_outgoing_links(id, linking, &nw)?;
+ outgoing_links_exist_as_incoming_links(id, linking, &nw)?;
+ }
+ Ok(())
}
}
diff --git a/lib/entry/libimagentryurl/src/iter.rs b/lib/entry/libimagentryurl/src/iter.rs
index 4a22a6b1..f899cb38 100644
--- a/lib/entry/libimagentryurl/src/iter.rs
+++ b/lib/entry/libimagentryurl/src/iter.rs
@@ -32,9 +32,10 @@
use libimagentrylink::link::Link;
use libimagentrylink::iter::LinkIter;
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 +171,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))
+ .context("Error happened while getting link URI from FLE")
+ .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)?;