Page MenuHomePhabricator

D5094.diff
No OneTemporary

D5094.diff

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
@@ -237,9 +237,8 @@
holder_char: *const c_char,
field_index: usize,
data: *const c_char,
-) -> Result<(), String> {
- let holder = c_char_pointer_to_string(holder_char)?;
- check_error(&ERROR_MESSAGES)?;
+) -> anyhow::Result<(), anyhow::Error> {
+ let holder = c_char_pointer_to_string_new(holder_char)?;
let data_c_str: &CStr = unsafe { CStr::from_ptr(data) };
let data_bytes: Vec<u8> = data_c_str.to_bytes().to_vec();
@@ -247,33 +246,20 @@
if let Ok(clients) = CLIENTS.lock() {
let maybe_client = clients.get(&holder);
if let Some(client) = maybe_client {
- match client
+ client
.tx
.send(PutRequestData {
field_index,
data: data_bytes,
})
- .await
- {
- Ok(_) => (),
- Err(err) => report_error(
- &ERROR_MESSAGES,
- &format!("send data to receiver failed: {}", err),
- Some("put"),
- ),
- }
- } else {
- report_error(
- &ERROR_MESSAGES,
- "no client detected in write",
- Some("put"),
- );
+ .await?;
+ return Ok(());
}
+ bail!(format!("no client detected for {} in write", holder));
} else {
- report_error(&ERROR_MESSAGES, "couldn't access client", Some("put"));
+ bail!("couldn't access clients");
}
- });
- check_error(&ERROR_MESSAGES)?;
+ })?;
Ok(())
}

File Metadata

Mime Type
text/plain
Expires
Tue, Nov 26, 6:05 AM (20 h, 20 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2583199
Default Alt Text
D5094.diff (1 KB)

Event Timeline