We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 5708bba commit 6ac053aCopy full SHA for 6ac053a
src/ephemeral.rs
@@ -69,7 +69,7 @@ use std::num::ParseIntError;
69
use std::str::FromStr;
70
use std::time::{Duration, UNIX_EPOCH};
71
72
-use anyhow::{ensure, Result};
+use anyhow::{ensure, Context as _, Result};
73
use async_channel::Receiver;
74
use serde::{Deserialize, Serialize};
75
use tokio::time::timeout;
@@ -176,15 +176,12 @@ impl ChatId {
176
pub async fn get_ephemeral_timer(self, context: &Context) -> Result<Timer> {
177
let timer = context
178
.sql
179
- .query_row(
+ .query_get_value(
180
"SELECT IFNULL(ephemeral_timer, 0) FROM chats WHERE id=?",
181
(self,),
182
- |row| {
183
- let timer: Timer = row.get(0)?;
184
- Ok(timer)
185
- },
186
)
187
- .await?;
+ .await?
+ .with_context(|| format!("Chat {self} not found"))?;
188
Ok(timer)
189
}
190
0 commit comments