diff options
-rw-r--r-- | lib/core/libimagstore/src/store.rs | 6 | ||||
-rw-r--r-- | lib/entry/libimagentryurl/src/iter.rs | 7 | ||||
-rw-r--r-- | lib/entry/libimagentryurl/src/linker.rs | 8 |
3 files changed, 9 insertions, 12 deletions
diff --git a/lib/core/libimagstore/src/store.rs b/lib/core/libimagstore/src/store.rs index f30b43a3..b7ffa35d 100644 --- a/lib/core/libimagstore/src/store.rs +++ b/lib/core/libimagstore/src/store.rs @@ -47,9 +47,6 @@ use crate::file_abstraction::FileAbstractionInstance; use crate::file_abstraction::fs::FSFileAbstraction; use crate::file_abstraction::inmemory::InMemoryFileAbstraction; -use libimagutil::debug_result::*; - - #[derive(Debug, PartialEq)] enum StoreEntryStatus { Present, @@ -199,8 +196,7 @@ impl Store { backend .create_dir_all(&location) - .context(format_err!("StorePathCreate: {}", location.display())) - .map_dbg_err_str("Failed")?; + .context(format_err!("StorePathCreate: {}", location.display()))?; } else if location.is_file() { debug!("Store path exists as file"); return Err(format_err!("StorePathExists: {}", location.display())); 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)?; |