diff options
Diffstat (limited to 'filamento/src/logic/connect.rs')
-rw-r--r-- | filamento/src/logic/connect.rs | 38 |
1 files changed, 12 insertions, 26 deletions
diff --git a/filamento/src/logic/connect.rs b/filamento/src/logic/connect.rs index 4dc789e..d7b9fee 100644 --- a/filamento/src/logic/connect.rs +++ b/filamento/src/logic/connect.rs @@ -27,11 +27,8 @@ pub async fn handle_connect(logic: ClientLogic, connection: Connected) { let online = match online { Ok(online) => online, Err(e) => { - let _ = logic - .update_sender() - .send(UpdateMessage::Error(Error::Connecting( - ConnectionJobError::StatusCacheError(e.into()), - ))) + logic + .handle_error(ConnectionJobError::StatusCacheError(e.into()).into()) .await; Online::default() } @@ -53,37 +50,26 @@ pub async fn handle_connect(logic: ClientLogic, connection: Connected) { .send(UpdateMessage::Online(online, roster)) .await; } - Err(e) => { - let _ = logic - .update_sender() - .send(UpdateMessage::Error(Error::Connecting(e.into()))) - .await; - } + Err(e) => logic.handle_error(Error::Connecting(e.into())).await, }, Err(e) => { - let _ = logic - .update_sender() - .send(UpdateMessage::Error(Error::Connecting( - ConnectionJobError::SendPresence(WriteError::Actor(e.into())), - ))) + logic + .handle_error( + ConnectionJobError::SendPresence(WriteError::Actor(e.into())) + .into(), + ) .await; } } } Err(e) => { - let _ = logic - .update_sender() - .send(UpdateMessage::Error(Error::Connecting(e.into()))) - .await; + logic.handle_error(Error::Connecting(e.into())).await; } }, Err(e) => { - let _ = logic - .update_sender() - .send(UpdateMessage::Error(Error::Connecting( - ConnectionJobError::RosterRetreival(RosterError::Write(WriteError::Actor( - e.into(), - ))), + logic + .handle_error(Error::Connecting(ConnectionJobError::RosterRetreival( + RosterError::Write(WriteError::Actor(e.into())), ))) .await; } |