From 516a5e9c5f20f7180f027f73f875e5813465813a Mon Sep 17 00:00:00 2001 From: link2xt Date: Sun, 13 Nov 2022 20:21:36 +0000 Subject: [PATCH] Add contexts to both the timeout and actual IDLE error Note that `IMAP IDLE protocol timed out` was previously added to the wrong error: not the timeout error (first `?`) but actual error happened during IDLE, such as a network error. --- src/imap/idle.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/imap/idle.rs b/src/imap/idle.rs index 3fdff1cbb..9a62b9943 100644 --- a/src/imap/idle.rs +++ b/src/imap/idle.rs @@ -97,8 +97,9 @@ impl Imap { } let session = tokio::time::timeout(Duration::from_secs(15), handle.done()) - .await? - .with_context(|| format!("{}: IMAP IDLE protocol timed out", folder_name))?; + .await + .with_context(|| format!("{}: IMAP IDLE protocol timed out", folder_name))? + .with_context(|| format!("{}: IMAP IDLE failed", folder_name))?; self.session = Some(Session { inner: session }); } else { warn!(context, "Attempted to idle without a session");