Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Report all non fatals to firebase #2914

Merged
merged 2 commits into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions app/src/org/commcare/logging/AndroidLogger.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,9 @@ public int logSize() {
public void halt() {
//Meh.
}

@Override
public void logException(Throwable e) {
CrashUtil.reportException(e);
}
}
6 changes: 6 additions & 0 deletions app/src/org/commcare/logging/PreInitLogger.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.commcare.logging;

import org.commcare.android.javarosa.AndroidLogEntry;
import org.commcare.utils.CrashUtil;
import org.javarosa.core.api.ILogger;
import org.javarosa.core.log.IFullLogSerializer;
import org.javarosa.core.log.StreamLogSerializer;
Expand Down Expand Up @@ -72,4 +73,9 @@ public int logSize() {
public void halt() {
// TODO Auto-generated method stub
}

@Override
public void logException(Throwable e) {
CrashUtil.reportException(e);
}
}
8 changes: 3 additions & 5 deletions app/src/org/commcare/tasks/templates/CommCareTask.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,15 @@ protected final Result doInBackground(Params... params) {
try {
return doTaskBackground(params);
} catch (Exception e) {
Logger.log(TAG, "Error during task execution: " + e.getMessage());
e.printStackTrace();

if (!(e instanceof UserCausedRuntimeException)) {
// Report crashes we know weren't caused by user misconfiguration
CrashUtil.reportException(e);
Logger.exception("Error during task execution: ", e);
} else {
Logger.log(TAG, "Error during task execution: " + e.getMessage());
}

// Save error for reporting during post-execute
unknownError = e;

return null;
}
}
Expand Down
Loading