mirror of
https://github.com/M66B/FairEmail.git
synced 2025-12-30 01:21:11 +01:00
Conditionally sanitize exceptions
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user