Skip to content
Chen

Command Palette

Search for a command to run...

Print stack trace of an exception in Kotlinx.Coroutinekotlin/coroutine/exception-handlerBy default, Kotlinx.Coroutine will not print stack trace of an exception. This snippet will print stack trace of an exception.

1fun CoroutineExceptionHandler(key: String) = kotlinx.coroutines.CoroutineExceptionHandler { _, exception ->
2    logger.error("$key coroutine uncaught exception", exception)
3}