mirror of
https://github.com/M66B/FairEmail.git
synced 2025-02-24 15:11:03 +00:00
Improved op error handling
This commit is contained in:
parent
33dcbb4039
commit
2f5cb0ec62
1 changed files with 17 additions and 16 deletions
|
@ -437,13 +437,28 @@ class Core {
|
||||||
ops.remove(s);
|
ops.remove(s);
|
||||||
} catch (Throwable ex) {
|
} catch (Throwable ex) {
|
||||||
Log.e(folder.name, ex);
|
Log.e(folder.name, ex);
|
||||||
db.operation().setOperationTries(op.id, op.tries);
|
|
||||||
|
|
||||||
EntityLog.log(context, folder.name +
|
EntityLog.log(context, folder.name +
|
||||||
" op=" + op.name +
|
" op=" + op.name +
|
||||||
" try=" + op.tries +
|
" try=" + op.tries +
|
||||||
" " + Log.formatThrowable(ex, false));
|
" " + 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) {
|
if (similar.size() > 0) {
|
||||||
// Retry individually
|
// Retry individually
|
||||||
group = false;
|
group = false;
|
||||||
|
@ -451,20 +466,6 @@ class Core {
|
||||||
continue;
|
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())
|
if (ifolder != null && !ifolder.isOpen())
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue