Situation: I have a crash popping up in my crashly...
# android
w
Situation: I have a crash popping up in my crashlytics, where a JobCancellationException is thrown, that has no usable stackstrace. Idea: Now I like to write a specific catch mechanism via Thread.setUncaughtExceptionHandler, so that I can inspect different properties of this JobCancellationException, and add it to the crashlytics crash report. I have tried quite some variations to force a JobCancellationException, but none of them have succeeded. Question: Does anyone know a small android-kotlin codesample that will for sure throw a JobCancellationException? Thanks for reading this!
a
CancellationException
should be ignored, they are a part of the internals of coroutines and shouldn’t be logged
This will cause an exception:
Copy code
runBlocking {
    withTimeoutOrNull(200) {
        // Will throw a CancellationException after
        // waiting for 200ms
        delay(400)
    }
}
w
thank you for helping me!