Filter authenticator exceptions

This commit is contained in:
M66B 2020-02-01 10:36:24 +01:00
parent 78af4fb6b1
commit ab4febd489
1 changed files with 3 additions and 2 deletions

View File

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