diff --git a/services/backup/blob_client/src/put_client.rs b/services/backup/blob_client/src/put_client.rs --- a/services/backup/blob_client/src/put_client.rs +++ b/services/backup/blob_client/src/put_client.rs @@ -25,6 +25,8 @@ rx_handle: None, })); static ref RUNTIME: Runtime = Runtime::new().unwrap(); + static ref ERROR_MESSAGES: Arc>> = + Arc::new(Mutex::new(Vec::new())); } fn is_initialized() -> bool { @@ -42,6 +44,21 @@ return true; } +fn report_error(message: String) { + ERROR_MESSAGES + .lock() + .expect("access error messages") + .push(message); +} + +fn check_error() -> Result<(), String> { + let errors = ERROR_MESSAGES.lock().expect("access error messages"); + match errors.is_empty() { + true => Ok(()), + false => Err(errors.join("\n"), + } +} + pub fn put_client_initialize_cxx() -> () { println!("[RUST] initializing"); assert!(!is_initialized(), "client cannot be initialized twice");