Provide better error message for M_UNKNOWN_TOKEN (#101)

This commit is contained in:
Ulyssa 2024-03-23 19:09:11 -07:00
parent 46e081b1e4
commit 1e9b6cc271
No known key found for this signature in database
GPG key ID: F2873CA2997B83C5
2 changed files with 28 additions and 13 deletions

View file

@ -79,6 +79,7 @@ use matrix_sdk::{
Client,
ClientBuildError,
DisplayName,
Error as MatrixError,
RoomMemberships,
};
@ -538,7 +539,7 @@ async fn send_receipts_forever(client: &Client, store: &AsyncProgramStore) {
}
}
pub async fn do_first_sync(client: &Client, store: &AsyncProgramStore) {
pub async fn do_first_sync(client: &Client, store: &AsyncProgramStore) -> Result<(), MatrixError> {
// Perform an initial, lazily-loaded sync.
let mut room = RoomEventFilter::default();
room.lazy_load_options = LazyLoadOptions::Enabled { include_redundant_members: false };
@ -551,10 +552,7 @@ pub async fn do_first_sync(client: &Client, store: &AsyncProgramStore) {
let settings = SyncSettings::new().filter(filter.into());
if let Err(e) = client.sync_once(settings).await {
tracing::error!(err = e.to_string(), "Failed to perform initial sync; will retry later");
return;
}
client.sync_once(settings).await?;
// Populate sync_info with our initial set of rooms/dms/spaces.
refresh_rooms(client, store).await;
@ -572,6 +570,8 @@ pub async fn do_first_sync(client: &Client, store: &AsyncProgramStore) {
let room_id = room.as_ref().0.room_id().to_owned();
need_load.insert(room_id, Need::MESSAGES);
}
Ok(())
}
#[derive(Debug)]