Simplified error handling

This commit is contained in:
M66B
2019-06-23 20:56:07 +02:00
parent b5921b8390
commit dea368dd96
9 changed files with 89 additions and 148 deletions

View File

@@ -382,33 +382,24 @@ public class Helper {
}
static String formatThrowable(Throwable ex) {
return formatThrowable(ex, false, " ");
return formatThrowable(ex, " ");
}
static String formatThrowable(Throwable ex, boolean sanitize) {
return formatThrowable(ex, sanitize, " ");
}
static String formatThrowable(Throwable ex, String separator) {
if (ex instanceof MessageRemovedException)
return null;
static String formatThrowable(Throwable ex, boolean sanitize, String separator) {
if (sanitize) {
if (ex instanceof MessageRemovedException)
return null;
if (ex instanceof IOException &&
ex.getCause() instanceof MessageRemovedException)
return null;
if (ex instanceof IOException &&
ex.getCause() instanceof MessageRemovedException)
return null;
if (ex instanceof FolderClosedException)
return null;
if (ex instanceof FolderClosedException)
return null;
if (ex instanceof IllegalStateException &&
("Not connected".equals(ex.getMessage()) ||
"This operation is not allowed on a closed folder".equals(ex.getMessage())))
return null;
//if (ex instanceof MailConnectException && ex.getCause() instanceof UnknownHostException)
// return null;
}
if (ex instanceof IllegalStateException &&
("Not connected".equals(ex.getMessage()) ||
"This operation is not allowed on a closed folder".equals(ex.getMessage())))
return null;
StringBuilder sb = new StringBuilder();
if (BuildConfig.DEBUG)