1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-12-27 19:15:50 +01:00

Log exceptions during DBAccess async tasks

This commit is contained in:
José Rebelo 2024-11-17 00:01:40 +00:00
parent e453855e88
commit 1618fda418

View File

@ -20,11 +20,16 @@ import android.content.Context;
import android.os.AsyncTask;
import android.widget.Toast;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.util.GB;
public abstract class DBAccess extends AsyncTask {
private static final Logger LOG = LoggerFactory.getLogger(DBAccess.class);
private final String mTask;
private final Context mContext;
private Exception mError;
@ -45,6 +50,7 @@ public abstract class DBAccess extends AsyncTask {
try (DBHandler db = GBApplication.acquireDB()) {
doInBackground(db);
} catch (Exception e) {
LOG.error("Error during DBAccess for {}", mTask, e);
mError = e;
}
return null;