Simplified error message

pull/207/head
M66B 3 years ago
parent 0a62c43923
commit e8406da5ff

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

Loading…
Cancel
Save