Conditionally sanitize exceptions

This commit is contained in:
M66B
2019-06-26 16:51:29 +02:00
parent 4cc1ed3a85
commit 286a6a9720
11 changed files with 48 additions and 42 deletions

View File

@@ -382,27 +382,33 @@ public class Helper {
}
static String formatThrowable(Throwable ex) {
return formatThrowable(ex, " ");
return formatThrowable(ex, true);
}
static String formatThrowable(Throwable ex, String separator) {
if (ex instanceof MessageRemovedException)
return null;
static String formatThrowable(Throwable ex, boolean santize) {
return formatThrowable(ex, " ", santize);
}
if (ex instanceof IOException &&
ex.getCause() instanceof MessageRemovedException)
return null;
static String formatThrowable(Throwable ex, String separator, boolean sanitize) {
if (sanitize) {
if (ex instanceof MessageRemovedException)
return null;
if (ex instanceof FolderClosedException)
return null;
if (ex instanceof IOException &&
ex.getCause() instanceof MessageRemovedException)
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 FolderClosedException)
return null;
if (ex instanceof Core.AlertException)
return ex.getMessage();
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 Core.AlertException)
return ex.getMessage();
}
StringBuilder sb = new StringBuilder();
if (BuildConfig.DEBUG)