Firebase Crashlytics not logging exception

  Kiến thức lập trình

I’ve enabled Crashlytics in my app and have successfully triggered a test crash using this
(throw RuntimeException(“Test Crash from MainActivity”)). I was experimenting with crashlytics in different scenarios and can’t get it to trigger an event in the Crashlytics console. In the following code I set the firebase document ID to “” to trigger an exception. In debug I can see the line for Firebase.Crashlytics.getInstance().recordException(e) is being executed.

override suspend fun updateCasinoName(casino: Casino): Result<Boolean> {

        return try {
            casino.firebaseId = ""
            val document = db.collection("casinos").document(casino.firebaseId)
            document.update("name", casino.name).await()
            Result.success(true)
        } catch (e: Exception) {
            FirebaseCrashlytics.getInstance().recordException(e)
            Result.failure(e)
        }
    }

Maybe I have a conceptual error of how it’s supposed to work, but I believe this should trigger an event in the Firebase Crashlytics Console even though it’s not a fatal error.

LEAVE A COMMENT