Files
kotlin-fork/kotlin-native/backend.native/tests/interop/exceptions/exceptionHook.kt
T
Alexander Shabalin 29f3445721 [K/N] Deprecated freezing ^KT-50541
Starting with 1.7.20 freezing is deprecated. See https://github.com/JetBrains/kotlin/blob/master/kotlin-native/NEW_MM.md#freezing-deprecation for details.

Merge-request: KT-MR-6399
Merged-by: Alexander Shabalin <Alexander.Shabalin@jetbrains.com>
2022-06-16 09:04:14 +00:00

13 lines
296 B
Kotlin

@file:OptIn(FreezingIsDeprecated::class)
import kotlin.native.concurrent.freeze
// KT-47828
fun setHookAndThrow() {
val hook = { _: Throwable ->
println("OK. Kotlin unhandled exception hook")
}
hook.freeze()
setUnhandledExceptionHook(hook)
throw Exception("Error")
}