Simplified error message

This commit is contained in:
M66B 2022-04-30 11:52:08 +02:00
parent 0a62c43923
commit e8406da5ff
1 changed files with 13 additions and 2 deletions

View File

@ -595,7 +595,8 @@ public class BoundaryCallbackMessages extends PagedList.BoundaryCallback<TupleMe
if (ex instanceof ProtocolException &&
ex.getMessage() != null &&
ex.getMessage().contains("full text search not supported")) {
String msg = context.getString(R.string.title_service_auth, ex.toString());
String msg = context.getString(R.string.title_service_auth,
account.host + ": " + getMessage(ex));
ApplicationEx.getMainHandler().post(new Runnable() {
@Override
public void run() {
@ -614,7 +615,7 @@ public class BoundaryCallbackMessages extends PagedList.BoundaryCallback<TupleMe
if (ex instanceof ProtocolException)
pex = new ProtocolException(
context.getString(R.string.title_service_auth,
account.host + ": " + ex.getMessage()),
account.host + ": " + getMessage(ex)),
ex.getCause());
else
pex = new ProtocolException("Search " + account.host, ex);
@ -735,6 +736,16 @@ public class BoundaryCallbackMessages extends PagedList.BoundaryCallback<TupleMe
return found;
}
private String getMessage(Throwable ex) {
if (ex instanceof ProtocolException) {
Response r = ((ProtocolException) ex).getResponse();
if (r != null && !TextUtils.isEmpty(r.getRest()))
return r.getRest();
}
return ex.toString();
}
private Message[] search(boolean utf8, String[] keywords, IMAPProtocol protocol, State state) throws IOException, MessagingException, ProtocolException {
EntityLog.log(context, "Search utf8=" + utf8);