Skip to content

Commit

Permalink
fix(file): Adds error log when IO errors occur on invoice/parcel create
Browse files Browse the repository at this point in the history
This will now log an error when the bindle server initially tries to create
directories for invoices or parcels. I checked the embedded provider and these
kind of errors are caught on creation

Closes #297
  • Loading branch information
thomastaylor312 committed Feb 4, 2022
1 parent f18a4b4 commit 62c26ce
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/provider/file/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,10 @@ impl<T: crate::search::Search + Send + Sync> Provider for FileProvider<T> {
return Err(ProviderError::Exists);
}
trace!(path = %inv_path.display(), "Base path doesn't exist, creating");
create_dir_all(inv_path).await?;
if let Err(e) = create_dir_all(inv_path).await {
error!(error = %e, "Unable to create invoice storage directory");
return Err(e.into());
}
}

// Open the destination or error out if it already exists.
Expand Down Expand Up @@ -349,7 +352,10 @@ impl<T: crate::search::Search + Send + Sync> Provider for FileProvider<T> {
}
// Create box dir
trace!(path = %par_path.display(), "Creating parcel directory");
create_dir_all(par_path).await?;
if let Err(e) = create_dir_all(par_path).await {
error!(error = %e, "Unable to create parcel storage directory");
return Err(e.into());
}

// Write data
let mut part = PartFile::new(self.parcel_data_path(parcel_id)).await?;
Expand Down

0 comments on commit 62c26ce

Please sign in to comment.