Log Non-fatal errors on Crashlytics

Eselfar picture Eselfar · Mar 29, 2017 · Viewed 20.5k times · Source

On iOS it's possible to use recordError(error) to log non-fatal errors on Crashlytics but apparently this feature is not available for Android.

The only alternative I found is to use logException(e). I manage errors on my app and I want to log when specifics errors codes are returned. So, on Crashlytics I'd like the non-fatal errors to be referenced by the errorCode. But using the logException(e) method, errors are referenced by the method where logException(e) has been called.

How can I do that?

Answer

Nicolás Carrasco picture Nicolás Carrasco · May 26, 2017

What I do in order to report a non-fatal issue is to log an exception using the following code (remember you can throw any subclass of Exception):

Crashlytics.logException(new Exception("My custom error message"));