From 8ed4279759d5fda5ab393c2d02ba04fe827ab922 Mon Sep 17 00:00:00 2001 From: Elena Lepilkina Date: Wed, 3 Nov 2021 12:25:07 +0300 Subject: [PATCH] [K/N] Fix wasm build --- kotlin-native/runtime/src/main/cpp/Exceptions.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/kotlin-native/runtime/src/main/cpp/Exceptions.cpp b/kotlin-native/runtime/src/main/cpp/Exceptions.cpp index 2f33dbcfca7..550a592ab86 100644 --- a/kotlin-native/runtime/src/main/cpp/Exceptions.cpp +++ b/kotlin-native/runtime/src/main/cpp/Exceptions.cpp @@ -46,11 +46,15 @@ void ThrowException(KRef exception) { } void HandleCurrentExceptionWhenLeavingKotlinCode() { +#if KONAN_NO_EXCEPTIONS + RuntimeCheck(false, "Exceptions unsupported"); +#else try { std::rethrow_exception(std::current_exception()); } catch (ExceptionObjHolder& e) { std::terminate(); // Terminate when it's a kotlin exception. } +#endif } namespace {