handleException

abstract fun handleException(context: CoroutineContext, exception: Throwable)(source)

Handles an exception that occurred in the given context. It is invoked if a coroutine fails without a clear propagation path, as described in the CoroutineExceptionHandler documentation.

handleException is invoked inside coroutine machinery in an unspecified thread. Therefore, it must be thread-safe and finish quickly.

Throwing exceptions from this method is discouraged and will invoke platform-specific last-resort exception handling, described in the CoroutineExceptionHandler documentation.