1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-30 05:52:57 +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.os.AsyncTask;
import android.widget.Toast; import android.widget.Toast;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import nodomain.freeyourgadget.gadgetbridge.GBApplication; import nodomain.freeyourgadget.gadgetbridge.GBApplication;
import nodomain.freeyourgadget.gadgetbridge.R; import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.util.GB; import nodomain.freeyourgadget.gadgetbridge.util.GB;
public abstract class DBAccess extends AsyncTask { public abstract class DBAccess extends AsyncTask {
private static final Logger LOG = LoggerFactory.getLogger(DBAccess.class);
private final String mTask; private final String mTask;
private final Context mContext; private final Context mContext;
private Exception mError; private Exception mError;
@ -45,6 +50,7 @@ public abstract class DBAccess extends AsyncTask {
try (DBHandler db = GBApplication.acquireDB()) { try (DBHandler db = GBApplication.acquireDB()) {
doInBackground(db); doInBackground(db);
} catch (Exception e) { } catch (Exception e) {
LOG.error("Error during DBAccess for {}", mTask, e);
mError = e; mError = e;
} }
return null; return null;