CoroutineExceptionHandler

Creates a CoroutineExceptionHandler instance.

When an exception without a propagation path is thrown, handler is invoked with the CoroutineContext of the coroutine where the exception occurred, as well as the problematic Throwable itself. See the CoroutineExceptionHandler interface documentation for a description of propagation paths.

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

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