diff --git a/app/src/main/java/eu/faircode/email/EmailService.java b/app/src/main/java/eu/faircode/email/EmailService.java index 100eca1ee6..01141cd5ae 100644 --- a/app/src/main/java/eu/faircode/email/EmailService.java +++ b/app/src/main/java/eu/faircode/email/EmailService.java @@ -2,6 +2,7 @@ package eu.faircode.email; import android.accounts.Account; import android.accounts.AccountManager; +import android.accounts.AuthenticatorException; import android.content.Context; import android.content.SharedPreferences; import android.text.TextUtils; @@ -275,13 +276,13 @@ public class EmailService implements AutoCloseable { am.invalidateAuthToken(type, password); String token = am.blockingGetAuthToken(account, getAuthTokenType(type), true); if (token == null) - throw new IllegalArgumentException("No token on refresh"); + throw new AuthenticatorException("No token on refresh"); connect(host, port, user, token, factory); return token; } - throw new IllegalArgumentException("Account not found"); + throw new AuthenticatorException("Account not found"); } catch (Exception ex1) { Log.e(ex1); throw new AuthenticationFailedException(ex.getMessage(), ex1);