From f22b229a09fb0a1959c3eb26fccc24bd7cb3fafb Mon Sep 17 00:00:00 2001 From: Victoria Petrakovich <78360457+PetrakovichVictoria@users.noreply.github.com> Date: Mon, 22 Apr 2024 14:35:56 +0200 Subject: [PATCH] fix the link to `Thread.uncaughtExceptionHandler` --- docs/topics/exception-handling.md | 4 ++-- .../jvm/test/guide/test/ExceptionsGuideTest.kt | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/topics/exception-handling.md b/docs/topics/exception-handling.md index ab1ec6a49a..f79740c95f 100644 --- a/docs/topics/exception-handling.md +++ b/docs/topics/exception-handling.md @@ -60,7 +60,7 @@ The output of this code is (with [debug](https://github.com/Kotlin/kotlinx.corou ```text Throwing exception from launch -Exception in thread "DefaultDispatcher-worker-2 @coroutine#2" java.lang.IndexOutOfBoundsException +Exception in thread "DefaultDispatcher-worker-1 @coroutine#2" java.lang.IndexOutOfBoundsException Joined failed job Throwing exception from async Caught ArithmeticException @@ -73,7 +73,7 @@ Caught ArithmeticException It is possible to customize the default behavior of printing **uncaught** exceptions to the console. [CoroutineExceptionHandler] context element on a _root_ coroutine can be used as a generic `catch` block for this root coroutine and all its children where custom exception handling may take place. -It is similar to [`Thread.uncaughtExceptionHandler`](https://docs.oracle.com/javase/8/docs/api/java/lang/Thread.html#setUncaughtExceptionHandler(java.lang.Thread.UncaughtExceptionHandler)). +It is similar to [`Thread.uncaughtExceptionHandler`](https://docs.oracle.com/javase/8/docs/api/java/lang/Thread.html#setUncaughtExceptionHandler-java.lang.Thread.UncaughtExceptionHandler-). You cannot recover from the exception in the `CoroutineExceptionHandler`. The coroutine had already completed with the corresponding exception when the handler is called. Normally, the handler is used to log the exception, show some kind of error message, terminate, and/or restart the application. diff --git a/kotlinx-coroutines-core/jvm/test/guide/test/ExceptionsGuideTest.kt b/kotlinx-coroutines-core/jvm/test/guide/test/ExceptionsGuideTest.kt index 33da0a7bc7..dc600616e1 100644 --- a/kotlinx-coroutines-core/jvm/test/guide/test/ExceptionsGuideTest.kt +++ b/kotlinx-coroutines-core/jvm/test/guide/test/ExceptionsGuideTest.kt @@ -9,7 +9,7 @@ class ExceptionsGuideTest { fun testExampleExceptions01() { test("ExampleExceptions01") { kotlinx.coroutines.guide.exampleExceptions01.main() }.verifyExceptions( "Throwing exception from launch", - "Exception in thread \"DefaultDispatcher-worker-2 @coroutine#2\" java.lang.IndexOutOfBoundsException", + "Exception in thread \"DefaultDispatcher-worker-1 @coroutine#2\" java.lang.IndexOutOfBoundsException", "Joined failed job", "Throwing exception from async", "Caught ArithmeticException"