From 6f8c00c690c2cac384958a1a0f5d913b0b46289c Mon Sep 17 00:00:00 2001 From: M66B Date: Tue, 12 Mar 2019 18:26:51 +0000 Subject: [PATCH] Improved send error handling --- app/src/main/java/eu/faircode/email/Core.java | 1 - app/src/main/java/eu/faircode/email/ServiceSend.java | 10 +++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/Core.java b/app/src/main/java/eu/faircode/email/Core.java index ad8f4d9c31..e6298d4d4c 100644 --- a/app/src/main/java/eu/faircode/email/Core.java +++ b/app/src/main/java/eu/faircode/email/Core.java @@ -210,7 +210,6 @@ class Core { // Operation succeeded db.operation().deleteOperation(op.id); } catch (Throwable ex) { - // TODO: SMTP response codes: https://www.ietf.org/rfc/rfc821.txt Log.e(folder.name, ex); reportError(context, account, folder, ex); diff --git a/app/src/main/java/eu/faircode/email/ServiceSend.java b/app/src/main/java/eu/faircode/email/ServiceSend.java index f59536e927..3a3ca5c64e 100644 --- a/app/src/main/java/eu/faircode/email/ServiceSend.java +++ b/app/src/main/java/eu/faircode/email/ServiceSend.java @@ -194,16 +194,20 @@ public class ServiceSend extends LifecycleService { db.operation().deleteOperation(op.id); } catch (Throwable ex) { - Log.e(ex); + Log.e(outbox.name, ex); + Core.reportError(ServiceSend.this, null, outbox, ex); + db.operation().setOperationError(op.id, Helper.formatThrowable(ex)); if (message != null) db.message().setMessageError(message.id, Helper.formatThrowable(ex)); if (ex instanceof MessageRemovedException || ex instanceof SendFailedException || - ex instanceof IllegalArgumentException) + ex instanceof IllegalArgumentException) { + Log.w("Unrecoverable"); db.operation().deleteOperation(op.id); - else + continue; + } else throw ex; } finally { Log.i(outbox.name + " end op=" + op.id + "/" + op.name);