11use crate :: fungi:: meta:: { Ino , Inode } ;
22use crate :: fungi:: { Error , Result , Writer } ;
3- use crate :: store:: { BlockStore , Store } ;
3+ use crate :: store:: { BlockStore , Error as StoreError , Store } ;
44use anyhow:: Context ;
55use futures:: lock:: Mutex ;
66use std:: collections:: LinkedList ;
@@ -19,7 +19,7 @@ type FailuresList = Arc<Mutex<Vec<(PathBuf, Error)>>>;
1919#[ derive( Debug ) ]
2020struct Item ( Ino , PathBuf , OsString , Metadata ) ;
2121/// creates an FL from the given root location. It takes ownership of the writer because
22- /// it's logically incorrect to store multiple filessytem in the same FL.
22+ /// it's logically incorrect to store multiple filesystem in the same FL.
2323/// All file chunks will then be uploaded to the provided store
2424///
2525pub async fn pack < P : Into < PathBuf > , S : Store > (
@@ -239,7 +239,16 @@ where
239239 }
240240
241241 // write block to remote store
242- let block = self . store . set ( & self . buffer [ ..size] ) . await ?;
242+ let store_result = self . store . set ( & self . buffer [ ..size] ) . await ;
243+
244+ if let Err ( store_err) = & store_result {
245+ if let StoreError :: Other ( _) = store_err {
246+ log:: error!( "failed to upload file {}: {:#}" , path. display( ) , store_err) ;
247+ std:: process:: exit ( 1 ) ; // Force immediate termination
248+ }
249+ }
250+
251+ let block = store_result. map_err ( Error :: Store ) ?;
243252
244253 // write block info to meta
245254 self . writer . block ( ino, & block. id , & block. key ) . await ?;
0 commit comments