@@ -128,7 +128,7 @@ use serde::de::DeserializeOwned;
128128use thiserror:: Error ;
129129use tokio:: { join, sync:: broadcast} ;
130130use tokio_stream:: StreamExt ;
131- use tracing:: { debug, error, info, instrument, warn} ;
131+ use tracing:: { debug, error, info, instrument, trace , warn} ;
132132
133133use self :: futures:: { SendAttachment , SendMessageLikeEvent , SendRawMessageLikeEvent } ;
134134pub 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