Return error if create() fails

This commit is contained in:
Matthias Beyer 2016-01-18 23:00:51 +01:00
parent 0c3bcc3f15
commit c48f3afcf4

View file

@ -58,7 +58,11 @@ impl Store {
use std::fs::create_dir_all; use std::fs::create_dir_all;
if !location.exists() { if !location.exists() {
create_dir_all(location.clone()).ok(); // TODO: Error handling? let c = create_dir_all(location.clone());
if c.is_err() {
return Err(StoreError::new(StoreErrorKind::StorePathCreate,
Some(Box::new(c.err().unwrap()))));
}
} else { } else {
if location.is_file() { if location.is_file() {
return Err(StoreError::new(StoreErrorKind::StorePathExists, None)); return Err(StoreError::new(StoreErrorKind::StorePathExists, None));