From f640c65a0010b790bf995cb07c2fce2452a53ec9 Mon Sep 17 00:00:00 2001 From: link2xt Date: Sat, 11 Apr 2026 08:46:16 +0200 Subject: [PATCH] resultify --- deltachat-jsonrpc/src/api.rs | 2 +- src/context.rs | 4 ++-- src/scheduler.rs | 5 ++++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/deltachat-jsonrpc/src/api.rs b/deltachat-jsonrpc/src/api.rs index 61d4fe7c1..74165e305 100644 --- a/deltachat-jsonrpc/src/api.rs +++ b/deltachat-jsonrpc/src/api.rs @@ -323,7 +323,7 @@ impl CommandApi { /// I/O must be started for this request to take effect. async fn clear_all_relay_storage(&self, account_id: u32) -> Result<()> { let ctx = self.get_context(account_id).await?; - ctx.clear_all_relay_storage().await; + ctx.clear_all_relay_storage().await?; Ok(()) } diff --git a/src/context.rs b/src/context.rs index c32a3add4..e6347c29d 100644 --- a/src/context.rs +++ b/src/context.rs @@ -565,8 +565,8 @@ impl Context { /// Non-chatmail relays are excluded /// to avoid accidentally deleting emails /// from shared inboxes. - pub async fn clear_all_relay_storage(&self) { - self.scheduler.clear_all_relay_storage().await; + pub async fn clear_all_relay_storage(&self) -> Result<()> { + self.scheduler.clear_all_relay_storage().await } /// Restarts the IO scheduler if it was running before diff --git a/src/scheduler.rs b/src/scheduler.rs index 0ae6c6ac3..4710f7847 100644 --- a/src/scheduler.rs +++ b/src/scheduler.rs @@ -256,10 +256,13 @@ impl SchedulerState { } } - pub(crate) async fn clear_all_relay_storage(&self) { + pub(crate) async fn clear_all_relay_storage(&self) -> Result<()> { let inner = self.inner.read().await; if let InnerSchedulerState::Started(ref scheduler) = *inner { scheduler.clear_all_relay_storage(); + Ok(()) + } else { + bail!("IO is not started"); } }