summaryrefslogtreecommitdiffstats
path: root/libimagstore
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2016-09-08 15:13:32 +0200
committerMatthias Beyer <mail@beyermatthias.de>2016-10-15 15:49:00 +0200
commit2363d6ba306318e6d96a307aaf0a89e66cf733c8 (patch)
tree052a19ad7cce9ebd47a87742e99db20b4ea8525f /libimagstore
parent924692d7cb9efe19d14d06a51bd6af0ad0f737ec (diff)
Use try!() instead of unwrapping errors
Diffstat (limited to 'libimagstore')
-rw-r--r--libimagstore/src/store.rs10
1 files changed, 4 insertions, 6 deletions
diff --git a/libimagstore/src/store.rs b/libimagstore/src/store.rs
index bbf3e85e..e21bb2ce 100644
--- a/libimagstore/src/store.rs
+++ b/libimagstore/src/store.rs
@@ -57,6 +57,7 @@ use hook::Hook;
use libimagerror::into::IntoError;
use libimagerror::trace::trace_error;
use libimagutil::iter::FoldResult;
+use libimagutil::debug_result::*;
use self::glob_store_iter::*;
@@ -245,12 +246,9 @@ impl Store {
.map_err_into(SEK::IoError);
}
- debug!("Creating store path");
- let c = FileAbstraction::create_dir_all(&location);
- if c.is_err() {
- debug!("Failed");
- return Err(SEK::StorePathCreate.into_error_with_cause(Box::new(c.unwrap_err())));
- }
+ try!(FileAbstraction::create_dir_all(&location)
+ .map_err_into(SEK::StorePathCreate)
+ .map_dbg_err_str("Failed"));
} else if location.is_file() {
debug!("Store path exists as file");
return Err(SEK::StorePathExists.into_error());