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);
}
}
Mike from Fabric here. There isn't a way to override the grouping that we do on logged errors. I recommended being specific with the exception type and message instead of using a single exception class though that does come with the trade-off of increased code complexity.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With