Add some error inspection and logging

This commit is contained in:
2025-08-14 13:44:52 -03:00
parent 55431d580e
commit 1a446ae3bf
+7
View File
@@ -164,6 +164,7 @@ impl Command<State> for SkipCommand {
let call = Call::get_by_id(channel.call_id.unwrap(), &ctx.rt.state.db) let call = Call::get_by_id(channel.call_id.unwrap(), &ctx.rt.state.db)
.await .await
.inspect_err(|e| log::error!("Failed to get call: {e:?}"))
.map_err(|_| CommandError::DatabaseQueryFailed)? .map_err(|_| CommandError::DatabaseQueryFailed)?
.ok_or(CommandError::DatabaseInconsistentState)?; .ok_or(CommandError::DatabaseInconsistentState)?;
@@ -179,10 +180,16 @@ impl Command<State> for SkipCommand {
.create_message(Id::new(other_channel_id)) .create_message(Id::new(other_channel_id))
.content("☎️ The other party hung up the phone.") .content("☎️ The other party hung up the phone.")
.await .await
.inspect_err(|e| {
log::error!("Failed to send message to other party: {e:?}");
})
.map_err(|_| CommandError::MessageSendingFailed)?; .map_err(|_| CommandError::MessageSendingFailed)?;
let call = Call::start(&channel, &ctx.rt.state.db) let call = Call::start(&channel, &ctx.rt.state.db)
.await .await
.inspect_err(|e| {
log::error!("Failed to start (skipped) call: {e:?}");
})
.map_err(|_| CommandError::DatabaseQueryFailed)?; .map_err(|_| CommandError::DatabaseQueryFailed)?;
if let Some(call) = call { if let Some(call) = call {