mirror of
https://github.com/chatmail/core.git
synced 2026-04-28 19:06:35 +03:00
Use anyhow's with_context
This commit is contained in:
@@ -9,7 +9,7 @@ use async_std::prelude::*;
|
|||||||
use async_std::sync::{Arc, RwLock};
|
use async_std::sync::{Arc, RwLock};
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
|
||||||
use anyhow::{anyhow, ensure, Context as _, Result};
|
use anyhow::{ensure, Context as _, Result};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use crate::context::{Context, ContextError};
|
use crate::context::{Context, ContextError};
|
||||||
@@ -150,7 +150,7 @@ impl Accounts {
|
|||||||
.config
|
.config
|
||||||
.get_account(id)
|
.get_account(id)
|
||||||
.await
|
.await
|
||||||
.ok_or_else(|| anyhow!("No such account with id {}", id))?;
|
.with_context(|| format!("No such account with id {}", id))?;
|
||||||
let ctx = Context::new_encrypted(
|
let ctx = Context::new_encrypted(
|
||||||
account_config.dbfile().into(),
|
account_config.dbfile().into(),
|
||||||
account_config.id,
|
account_config.id,
|
||||||
|
|||||||
Reference in New Issue
Block a user