Improved auth failed error message

This commit is contained in:
M66B 2022-12-28 18:44:11 +01:00
parent 40eedcb4dd
commit d5dbb47948
1 changed files with 11 additions and 1 deletions

View File

@ -494,10 +494,20 @@ public class EmailService implements AutoCloseable {
Log.e(ex1);
else
Log.e(new Throwable(ex1.getMessage() + " error=" + cause.getMessage(), ex1));
String msg = ex.getMessage();
if (auth == AUTH_TYPE_GMAIL &&
msg != null && msg.endsWith("Invalid credentials (Failure)"))
msg += "; " + context.getString(R.string.title_service_token);
msg += "\n" + context.getString(R.string.title_service_token);
Throwable c = ex1;
while (c != null) {
String m = c.getMessage();
if (!TextUtils.isEmpty(m))
msg += "\n" + m;
c = c.getCause();
}
throw new AuthenticationFailedException(
context.getString(R.string.title_service_auth, msg),
ex.getNextException());