Improved op error handling

This commit is contained in:
M66B 2020-11-30 08:17:07 +01:00
parent 33dcbb4039
commit 2f5cb0ec62
1 changed files with 17 additions and 16 deletions

View File

@ -437,13 +437,28 @@ class Core {
ops.remove(s);
} catch (Throwable ex) {
Log.e(folder.name, ex);
db.operation().setOperationTries(op.id, op.tries);
EntityLog.log(context, folder.name +
" op=" + op.name +
" try=" + op.tries +
" " + Log.formatThrowable(ex, false));
try {
db.beginTransaction();
db.operation().setOperationTries(op.id, op.tries);
op.error = Log.formatThrowable(ex);
db.operation().setOperationError(op.id, op.error);
if (message != null &&
!(ex instanceof IllegalArgumentException))
db.message().setMessageError(message.id, op.error);
db.setTransactionSuccessful();
} finally {
db.endTransaction();
}
if (similar.size() > 0) {
// Retry individually
group = false;
@ -451,20 +466,6 @@ class Core {
continue;
}
try {
db.beginTransaction();
op.error = Log.formatThrowable(ex, false);
db.operation().setOperationError(op.id, Log.formatThrowable(ex));
if (message != null && !(ex instanceof IllegalArgumentException))
db.message().setMessageError(message.id, Log.formatThrowable(ex));
db.setTransactionSuccessful();
} finally {
db.endTransaction();
}
if (ifolder != null && !ifolder.isOpen())
break;