Log non-fatal exceptions with fabric (#80)

This commit is contained in:
Rafał Borcz 2018-04-08 17:34:18 +02:00 committed by Mikołaj Pich
parent b22d95392b
commit 0708d84b98
2 changed files with 10 additions and 5 deletions

View File

@ -3,6 +3,8 @@ package io.github.wulkanowy.data.db.resources;
import android.content.Context;
import android.content.res.Resources;
import com.crashlytics.android.Crashlytics;
import java.io.IOException;
import java.net.SocketTimeoutException;
import java.net.UnknownHostException;
@ -41,6 +43,7 @@ public class AppResources implements ResourcesContract {
@Override
public String getErrorLoginMessage(Exception exception) {
LogUtils.error(AppConstant.APP_NAME + " encountered a error", exception);
Crashlytics.logException(exception);
if (exception instanceof CryptoException) {
return resources.getString(R.string.encrypt_failed_text);

View File

@ -4,6 +4,7 @@ import android.app.PendingIntent;
import android.content.Context;
import android.support.v4.app.NotificationCompat;
import com.crashlytics.android.Crashlytics;
import com.firebase.jobdispatcher.Constraint;
import com.firebase.jobdispatcher.FirebaseJobDispatcher;
import com.firebase.jobdispatcher.GooglePlayDriver;
@ -75,6 +76,7 @@ public class SyncJob extends SimpleJobService {
}
return JobService.RESULT_SUCCESS;
} catch (Exception e) {
Crashlytics.logException(e);
LogUtils.error("During background synchronization an error occurred", e);
return JobService.RESULT_FAIL_RETRY;
}