1
0
mirror of https://github.com/wulkanowy/wulkanowy.git synced 2025-01-19 03:06:50 -06:00

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.Context;
import android.content.res.Resources; import android.content.res.Resources;
import com.crashlytics.android.Crashlytics;
import java.io.IOException; import java.io.IOException;
import java.net.SocketTimeoutException; import java.net.SocketTimeoutException;
import java.net.UnknownHostException; import java.net.UnknownHostException;
@ -41,6 +43,7 @@ public class AppResources implements ResourcesContract {
@Override @Override
public String getErrorLoginMessage(Exception exception) { public String getErrorLoginMessage(Exception exception) {
LogUtils.error(AppConstant.APP_NAME + " encountered a error", exception); LogUtils.error(AppConstant.APP_NAME + " encountered a error", exception);
Crashlytics.logException(exception);
if (exception instanceof CryptoException) { if (exception instanceof CryptoException) {
return resources.getString(R.string.encrypt_failed_text); return resources.getString(R.string.encrypt_failed_text);
@ -64,23 +67,23 @@ public class AppResources implements ResourcesContract {
} }
if (lesson.getIsAbsenceExcused()) { if (lesson.getIsAbsenceExcused()) {
id = R.string.attendance_absence_excused; id = R.string.attendance_absence_excused;
} }
if (lesson.getIsAbsenceUnexcused()) { if (lesson.getIsAbsenceUnexcused()) {
id = R.string.attendance_absence_unexcused; id = R.string.attendance_absence_unexcused;
} }
if (lesson.getIsExemption()) { if (lesson.getIsExemption()) {
id = R.string.attendance_exemption; id = R.string.attendance_exemption;
} }
if (lesson.getIsExcusedLateness()) { if (lesson.getIsExcusedLateness()) {
id = R.string.attendance_excused_lateness; id = R.string.attendance_excused_lateness;
} }
if (lesson.getIsUnexcusedLateness()) { if (lesson.getIsUnexcusedLateness()) {
id = R.string.attendance_unexcused_lateness; id = R.string.attendance_unexcused_lateness;
} }
return resources.getString(id); return resources.getString(id);

View File

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