Skip to content

Commit 7cda6d2

Browse files
committed
chore(sdk): Add more logs for Room::leave.
This patch adds a bit more logs in `Room::leave` to understand what's happening for some users.
1 parent 2ec1598 commit 7cda6d2

File tree

1 file changed

+6
-4
lines changed
  • crates/matrix-sdk/src/room

1 file changed

+6
-4
lines changed

crates/matrix-sdk/src/room/mod.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ use serde::de::DeserializeOwned;
128128
use thiserror::Error;
129129
use tokio::{join, sync::broadcast};
130130
use tokio_stream::StreamExt;
131-
use tracing::{debug, error, info, instrument, warn};
131+
use tracing::{debug, error, info, instrument, trace, warn};
132132

133133
use self::futures::{SendAttachment, SendMessageLikeEvent, SendRawMessageLikeEvent};
134134
pub use self::{
@@ -339,8 +339,6 @@ impl Room {
339339
// The server can return with an error that is acceptable to ignore. Let's find
340340
// which one.
341341
if let Err(error) = response {
342-
error!(?error, "Failed to leave the room");
343-
344342
#[allow(clippy::collapsible_match)]
345343
let ignore_error = if let Some(error) = error.client_api_error_kind() {
346344
match error {
@@ -353,6 +351,8 @@ impl Room {
353351
false
354352
};
355353

354+
error!(?error, ignore_error, should_forget, "Failed to leave the room");
355+
356356
if !ignore_error {
357357
return Err(error.into());
358358
}
@@ -361,8 +361,10 @@ impl Room {
361361
self.client.base_client().room_left(self.room_id()).await?;
362362

363363
if should_forget {
364+
trace!("Trying to forget the room");
365+
364366
if let Err(error) = self.forget().await {
365-
warn!("Failed to forget room when leaving it: {error}");
367+
error!(?error, "Failed to forget the room");
366368
}
367369
}
368370

0 commit comments

Comments
 (0)