mirror of
https://github.com/chatmail/core.git
synced 2026-05-06 16:36:59 +03:00
Error handling refactoring
- Replace .ok_or_else() and .map_err() with anyhow::Context where possible. - Use .context() to check Option for None when it's an error - Resultify Chatlist.get_chat_id() - Add useful .context() to some errors - IMAP error handling cleanup
This commit is contained in:
@@ -1280,11 +1280,13 @@ mod tests {
|
||||
let chats = Chatlist::try_load(&t, 0, None, None).await.unwrap();
|
||||
assert_eq!(chats.len(), 2);
|
||||
|
||||
let chat0 = Chat::load_from_db(&t, chats.get_chat_id(0)).await.unwrap();
|
||||
let chat0 = Chat::load_from_db(&t, chats.get_chat_id(0).unwrap())
|
||||
.await
|
||||
.unwrap();
|
||||
let (self_talk_id, device_chat_id) = if chat0.is_self_talk() {
|
||||
(chats.get_chat_id(0), chats.get_chat_id(1))
|
||||
(chats.get_chat_id(0).unwrap(), chats.get_chat_id(1).unwrap())
|
||||
} else {
|
||||
(chats.get_chat_id(1), chats.get_chat_id(0))
|
||||
(chats.get_chat_id(1).unwrap(), chats.get_chat_id(0).unwrap())
|
||||
};
|
||||
|
||||
// delete self-talk first; this adds a message to device-chat about how self-talk can be restored
|
||||
|
||||
Reference in New Issue
Block a user