Handle authentication failure when refreshing the folder list

This commit is contained in:
cketti 2022-06-17 13:40:45 +02:00
parent 00e0d8b35a
commit 238a5cd181
2 changed files with 5 additions and 0 deletions

View file

@ -395,6 +395,7 @@ public class MessagingController {
preferences.saveAccount(account);
} catch (Exception e) {
Timber.e(e);
handleException(account, e);
}
}

View file

@ -15,6 +15,7 @@ import java.util.Set;
import com.fsck.k9.logging.Timber;
import com.fsck.k9.mail.AuthType;
import com.fsck.k9.mail.AuthenticationFailedException;
import com.fsck.k9.mail.ConnectionSecurity;
import com.fsck.k9.mail.Flag;
import com.fsck.k9.mail.FolderType;
@ -115,6 +116,9 @@ class RealImapStore implements ImapStore, ImapConnectionManager, InternalImapSto
List<FolderListItem> subscribedFolders = listFolders(connection, true);
return limitToSubscribedFolders(folders, subscribedFolders);
} catch (AuthenticationFailedException e) {
connection.close();
throw e;
} catch (IOException | MessagingException ioe) {
connection.close();
throw new MessagingException("Unable to get folder list.", ioe);