Tolerate 404 on delete operations
- delete_task returns Ok(()) on 404 (already deleted) - delete_list returns Ok(()) on 404 (already deleted)
This commit is contained in:
@@ -393,6 +393,10 @@ impl ApiClient {
|
|||||||
.map_err(|e| ApiError::Network(e.to_string()))?;
|
.map_err(|e| ApiError::Network(e.to_string()))?;
|
||||||
|
|
||||||
if !resp.status().is_success() {
|
if !resp.status().is_success() {
|
||||||
|
// 404 means already deleted — treat as success
|
||||||
|
if resp.status() == 404 {
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
return Err(ApiError::Api(format!(
|
return Err(ApiError::Api(format!(
|
||||||
"Delete failed: {}",
|
"Delete failed: {}",
|
||||||
resp.status()
|
resp.status()
|
||||||
@@ -420,6 +424,10 @@ impl ApiClient {
|
|||||||
|
|
||||||
if !resp.status().is_success() {
|
if !resp.status().is_success() {
|
||||||
let status = resp.status();
|
let status = resp.status();
|
||||||
|
// 404 means already deleted — treat as success
|
||||||
|
if status == 404 {
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
let body = resp.text().await.unwrap_or_default();
|
let body = resp.text().await.unwrap_or_default();
|
||||||
return Err(ApiError::Api(format!("Delete list failed: {} - {}", status, body)));
|
return Err(ApiError::Api(format!("Delete list failed: {} - {}", status, body)));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user