aboutsummaryrefslogtreecommitdiffstats
path: root/filamento/src/logic/online.rs
diff options
context:
space:
mode:
Diffstat (limited to 'filamento/src/logic/online.rs')
-rw-r--r--filamento/src/logic/online.rs23
1 files changed, 6 insertions, 17 deletions
diff --git a/filamento/src/logic/online.rs b/filamento/src/logic/online.rs
index e8cbb33..967ebb2 100644
--- a/filamento/src/logic/online.rs
+++ b/filamento/src/logic/online.rs
@@ -75,10 +75,7 @@ pub async fn handle_online(logic: ClientLogic, command: Command, connection: Con
items.into_iter().map(|item| item.into()).collect();
if let Err(e) = logic.db().replace_cached_roster(contacts.clone()).await {
logic
- .update_sender()
- .send(UpdateMessage::Error(Error::Roster(RosterError::Cache(
- e.into(),
- ))))
+ .handle_error(Error::Roster(RosterError::Cache(e.into())))
.await;
};
result_sender.send(Ok(contacts));
@@ -573,11 +570,8 @@ pub async fn handle_online(logic: ClientLogic, command: Command, connection: Con
Command::SetStatus(online, sender) => {
let result = logic.db().upsert_cached_status(online.clone()).await;
if let Err(e) = result {
- let _ = logic
- .update_sender()
- .send(UpdateMessage::Error(Error::SetStatus(StatusError::Cache(
- e.into(),
- ))))
+ logic
+ .handle_error(StatusError::Cache(e.into()).into())
.await;
}
let result = connection
@@ -623,15 +617,10 @@ pub async fn handle_online(logic: ClientLogic, command: Command, connection: Con
.db()
.create_message_with_self_resource_and_chat(message.clone(), jid.clone())
.await
- .map_err(|e| e.into())
{
- tracing::error!("{}", e);
- let _ =
- logic
- .update_sender()
- .send(UpdateMessage::Error(Error::MessageSend(
- MessageSendError::MessageHistory(e),
- )));
+ logic
+ .handle_error(MessageSendError::MessageHistory(e.into()).into())
+ .await;
}
// TODO: don't do this, have separate from from details
message.from = message.from.as_bare();