From ab4febd489c1f1c4a44f0dbb8eec03ff19137d1e Mon Sep 17 00:00:00 2001 From: M66B Date: Sat, 1 Feb 2020 10:36:24 +0100 Subject: [PATCH] Filter authenticator exceptions --- app/src/main/java/eu/faircode/email/EmailService.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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);