Commit e286e9de authored by Michael Gratton's avatar Michael Gratton 🤞

Throw errors when IMAP or SMTP services have incomplete creds

Instead of just flagging the state, it means the error gets handled
correctly at a higher level.
parent c552633a
......@@ -387,16 +387,14 @@ internal class Geary.Imap.ClientService : Geary.ClientService {
debug("[%s] Opening new session", this.account.id);
Credentials? login = this.configuration.credentials;
if (login != null && !login.is_complete()) {
notify_authentication_failed();
throw new ImapError.UNAUTHENTICATED("Token not loaded");
}
ClientSession new_session = new ClientSession(remote);
yield new_session.connect_async(cancellable);
try {
yield new_session.initiate_session_async(
this.configuration.credentials, cancellable
);
yield new_session.initiate_session_async(login, cancellable);
} catch (Error err) {
// need to disconnect before throwing error ... don't
// honor Cancellable here, it's important to disconnect
......
......@@ -238,7 +238,7 @@ internal class Geary.Smtp.ClientService : Geary.ClientService {
throws Error {
Credentials? login = this.account.get_outgoing_credentials();
if (login != null && !login.is_complete()) {
notify_authentication_failed();
throw new SmtpError.AUTHENTICATION_FAILED("Token not loaded");
}
Smtp.ClientSession smtp = new Geary.Smtp.ClientSession(this.remote);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment