From 4bf191f06ba0e184e4222577b065720804d66362 Mon Sep 17 00:00:00 2001 From: mdecimus Date: Wed, 3 Jul 2024 15:58:34 +0200 Subject: [PATCH] Provide error details when failing to obtain modseq --- crates/imap/src/core/message.rs | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/crates/imap/src/core/message.rs b/crates/imap/src/core/message.rs index a98823d1..fe523f6d 100644 --- a/crates/imap/src/core/message.rs +++ b/crates/imap/src/core/message.rs @@ -215,7 +215,7 @@ impl SessionData { pub async fn get_modseq(&self, account_id: u32) -> crate::op::Result> { // Obtain current modseq - if let Ok(modseq) = self + match self .jmap .core .storage @@ -223,15 +223,17 @@ impl SessionData { .get_last_change_id(account_id, Collection::Email) .await { - Ok(modseq) - } else { - tracing::error!(parent: &self.span, - event = "error", - context = "store", - account_id = account_id, - collection = ?Collection::Email, - "Failed to obtain modseq"); - Err(StatusResponse::database_failure()) + Ok(modseq) => Ok(modseq), + Err(err) => { + tracing::error!(parent: &self.span, + event = "error", + context = "store", + account_id = account_id, + collection = ?Collection::Email, + reason = ?err, + "Failed to obtain modseq"); + Err(StatusResponse::database_failure()) + } } }