From c4f8841a5c58dd33e1f662d5e058e9c41227ce2f Mon Sep 17 00:00:00 2001 From: M66B Date: Sat, 8 Sep 2018 05:42:44 +0000 Subject: [PATCH] Notify send errors only --- .../java/eu/faircode/email/ServiceSynchronize.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/eu/faircode/email/ServiceSynchronize.java b/app/src/main/java/eu/faircode/email/ServiceSynchronize.java index a98cf7f5..430d037a 100644 --- a/app/src/main/java/eu/faircode/email/ServiceSynchronize.java +++ b/app/src/main/java/eu/faircode/email/ServiceSynchronize.java @@ -371,7 +371,14 @@ public class ServiceSynchronize extends LifecycleService { EntityLog.log(this, action + "\n" + ex.toString() + "\n" + Log.getStackTraceString(ex)); - if (!(ex instanceof MailConnectException) && + if (ex instanceof SendFailedException) { + NotificationManager nm = getSystemService(NotificationManager.class); + nm.notify(action, 1, getNotificationError(action, ex).build()); + } + + if (BuildConfig.DEBUG && + !(ex instanceof SendFailedException) && + !(ex instanceof MailConnectException) && !(ex instanceof FolderClosedException) && !(ex instanceof IllegalStateException) && !(ex instanceof AuthenticationFailedException) && // Also: Too many simultaneous connections @@ -777,6 +784,7 @@ public class ServiceSynchronize extends LifecycleService { } catch (Throwable ex) { Log.e(Helper.TAG, account.name + " " + ex + "\n" + Log.getStackTraceString(ex)); reportError(account.name, null, ex); + db.account().setAccountError(account.id, Helper.formatThrowable(ex)); } finally { // Close store @@ -1669,6 +1677,8 @@ public class ServiceSynchronize extends LifecycleService { } catch (Throwable ex) { Log.e(Helper.TAG, outbox.name + " " + ex + "\n" + Log.getStackTraceString(ex)); reportError(null, outbox.name, ex); + + db.folder().setFolderError(outbox.id, Helper.formatThrowable(ex)); } finally { Log.i(Helper.TAG, outbox.name + " end operations"); db.folder().setFolderState(outbox.id, null);