Improved send error handling

This commit is contained in:
M66B
2019-03-12 18:26:51 +00:00
parent a925185bb2
commit 6f8c00c690
2 changed files with 7 additions and 4 deletions

View File

@@ -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);