I'm trying to catch all uncaught exceptions for lo...
# getting-started
r
I'm trying to catch all uncaught exceptions for logging purposes. I am invoking
Thread.setDefaultUncaughtExceptionHandler
as the first thing I do in my main fun.
Copy code
fun main(args: Array<String>) {
    // Show a custom, better exception dialog
    Thread.setDefaultUncaughtExceptionHandler { _, throwable ->
        logTheExceptionAndQuit(throwable)
    }
-- but some exceptions are not getting caught by this handler. The exceptions in question originate in another library (of mine), where there's no special exception handling. Can anyone think why some exceptions might not reach this main handler?
s
Each thread has its own exception handler, so perhaps they're running in a different thread?