ilyagulya
05/06/2024, 1:01 PMEXCEPTION: JsException: Exception was thrown while running JavaScript code
JsException: Exception was thrown while running JavaScript code
Error:
at kotlin.captureStackTrace (file:///Users/ilyagulya/Projects/My/kotlin-wasmjs-arrays-benchmark/build/js/packages/kotlin-wasmjs-arrays-benchmark-wasm-js-wasmJsBenchmark/kotlin/kotlin-wasmjs-arrays-benchmark-wasm-js-wasmJsBenchmark.uninstantiated.mjs:16:44)
at kotlin.captureStackTrace__externalAdapter (<wasm://wasm/><kotlin-wasmjs-arrays-benchmark_wasmJsBenchmark>-0033f7ea:1:219072)
at kotlin.Throwable.<init> (<wasm://wasm/><kotlin-wasmjs-arrays-benchmark_wasmJsBenchmark>-0033f7ea:1:218731)
at kotlin.Throwable.<init> (<wasm://wasm/><kotlin-wasmjs-arrays-benchmark_wasmJsBenchmark>-0033f7ea:1:218849)
at kotlin.js.JsException.<init> (<wasm://wasm/><kotlin-wasmjs-arrays-benchmark_wasmJsBenchmark>-0033f7ea:1:220671)
at kotlin.wasm.internal.throwJsException (<wasm://wasm/><kotlin-wasmjs-arrays-benchmark_wasmJsBenchmark>-0033f7ea:1:219096)
at kotlinx.benchmark.CommonSuiteExecutor.runBenchmark (<wasm://wasm/><kotlin-wasmjs-arrays-benchmark_wasmJsBenchmark>-0033f7ea:1:266020)
at kotlinx.benchmark.CommonSuiteExecutor$run$lambda.invoke (<wasm://wasm/><kotlin-wasmjs-arrays-benchmark_wasmJsBenchmark>-0033f7ea:1:263662)
at kotlinx.benchmark.CommonSuiteExecutor$run$lambda.invoke (<wasm://wasm/><kotlin-wasmjs-arrays-benchmark_wasmJsBenchmark>-0033f7ea:1:263769)
at kotlinx.benchmark.runWithParameters (<wasm://wasm/><kotlin-wasmjs-arrays-benchmark_wasmJsBenchmark>-0033f7ea:1:282128)
How can I fix js exception capturing?
My environment right now:
Kotlin: 2.0.0-RC2
org.jetbrains.kotlinx.benchmark: 0.4.10
rootProject.the<NodeJsRootExtension>().apply {
nodeVersion = "21.0.0-v8-canary20231024d0ddc81258"
nodeDownloadBaseUrl = "<https://nodejs.org/download/v8-canary>"
}
ilyagulya
05/06/2024, 1:08 PMArtem Kobzar
05/06/2024, 2:12 PMIgor Yakovlev
05/06/2024, 2:29 PMquite useless exceptionsWell, having
JsException
without stack is better than not catching it at all, so it is not that useless, I think.
awesome to be able to see this stack in Kotlin exception insteadUnfortunately it is not possible with current implemented Wasm EH-proposal (maybe it is possible with a new EH-proposal? cc @Artem Kobzar). The only way now is to wrap all wasm-js interop calls with js
try-catch
block, generated by the compiler and seems not a good idea.ilyagulya
05/07/2024, 7:42 AMilyagulya
05/07/2024, 7:44 AMArtem Kobzar
05/07/2024, 7:45 AMArtem Kobzar
05/07/2024, 10:54 AM