I send to Crashlytics errors I get during sync with server. These errors mostly contain info about different data conflicts. All errors are wrapped into one exception class which has fields like apiErrorCode
. I can't create separate exception class for every error because there are dosens of them. So, all such exceptions that I send using Crashlytics.logException()
are grouped into one report on dashboard. So I have to go to "All sessions" and investigate errors one by one there, which is not convenient. Also I cannot close and lock some error types I don't want to see in reports (like some expected server errors). Is it a way to manually set Crashlytics grouping strategy (based on apiErrorCode
in my case)?
If you have different kind of exceptions coming from one stacktrace you can change stacktrace by adding one more custom element to top:
public class CustomException extends Exception {
public CustomException(String message, int lineNumber) {
super(message);
StackTraceElement[] stackTrace = getStackTrace();
StackTraceElement[] newStackTrace = new StackTraceElement[stackTrace.length + 1];
System.arraycopy(stackTrace, 0, newStackTrace, 1, stackTrace.length);
newStackTrace[0] = new StackTraceElement("className", "methodName", "fileName", lineNumber);
setStackTrace(newStackTrace);
}
}