1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2025-02-22 14:11:00 +00:00

Improved error reporting

This commit is contained in:
M66B 2021-07-27 21:04:48 +02:00
parent 7254f4ef06
commit 412ebca216

View file

@ -2269,7 +2269,7 @@ class Core {
private static void onSynchronizeMessages( private static void onSynchronizeMessages(
Context context, JSONArray jargs, Context context, JSONArray jargs,
EntityAccount account, final EntityFolder folder, EntityAccount account, final EntityFolder folder,
POP3Folder ifolder, POP3Store istore, State state) throws Throwable { POP3Folder ifolder, POP3Store istore, State state) throws MessagingException, IOException {
DB db = DB.getInstance(context); DB db = DB.getInstance(context);
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
boolean notify_known = prefs.getBoolean("notify_known", false); boolean notify_known = prefs.getBoolean("notify_known", false);
@ -2582,7 +2582,7 @@ class Core {
private static void onSynchronizeMessages( private static void onSynchronizeMessages(
Context context, JSONArray jargs, Context context, JSONArray jargs,
EntityAccount account, final EntityFolder folder, EntityAccount account, final EntityFolder folder,
IMAPStore istore, final IMAPFolder ifolder, State state) throws Throwable { IMAPStore istore, final IMAPFolder ifolder, State state) throws JSONException, MessagingException, IOException {
final DB db = DB.getInstance(context); final DB db = DB.getInstance(context);
try { try {
SyncStats stats = new SyncStats(); SyncStats stats = new SyncStats();
@ -4989,9 +4989,9 @@ class Core {
join(thread); join(thread);
} }
void ensureRunning(String reason) throws Throwable { void ensureRunning(String reason) {
if (!recoverable && unrecoverable != null) if (!recoverable && unrecoverable != null)
throw unrecoverable; throw new OperationCanceledExceptionEx(reason, unrecoverable);
if (!running) if (!running)
throw new OperationCanceledException(reason); throw new OperationCanceledException(reason);
} }
@ -5122,6 +5122,21 @@ class Core {
} }
} }
static class OperationCanceledExceptionEx extends OperationCanceledException {
private Throwable cause;
OperationCanceledExceptionEx(String message, Throwable cause) {
super(message);
this.cause = cause;
}
@Nullable
@Override
public Throwable getCause() {
return this.cause;
}
}
private static class SyncStats { private static class SyncStats {
long search_ms; long search_ms;
int flags; int flags;