Filter authenticator exceptions

pull/172/head
M66B 5 years ago
parent 78af4fb6b1
commit ab4febd489

@ -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);

Loading…
Cancel
Save