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.
This commit is contained in:
link2xt
2022-11-13 20:21:36 +00:00
parent 4744f5eecf
commit 516a5e9c5f

View File

@@ -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");