Return error if create() fails
This commit is contained in:
parent
0c3bcc3f15
commit
c48f3afcf4
1 changed files with 5 additions and 1 deletions
|
@ -58,7 +58,11 @@ impl Store {
|
|||
use std::fs::create_dir_all;
|
||||
|
||||
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 {
|
||||
if location.is_file() {
|
||||
return Err(StoreError::new(StoreErrorKind::StorePathExists, None));
|
||||
|
|
Loading…
Reference in a new issue